23/03/19 16:34:25.88 bczs8UVv0.net
サブルーチン
# 毎分|毎時 ng|μg|mg -> 毎分|毎時 mL
pattern='(毎分|毎時)(\\s*\\d+\\.?\\d*)\\s*(ng|μg|mg)'
m=regmatches(str,gregexec(pattern,str))[[1]]
if(length(m)!=0){
m5=numeric()
m5[m[4,]=='ng']=ng
m5[m[4,]=='μg']=mcg
m5[m[4,]=='mg']=mg
M=t(rbind(m[1,],paste0(m[2,], as.numeric(m[3,])*mL/m5,'mL')))
for(i in 1:nrow(M)){
str=sub(M[i,1],M[i,2],str)
}
}