Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ###建立1~250的數字,當作處置代號
- df=matrix(ncol=5,nrow=50,c(1:250))
- df=as.data.frame(df)
- ###結合所有處置代號成為一個欄位
- df$combine=paste(df[,1],df[,2],df[,3],df[,4],df[,5])
- ###用grepl分別對各個藥名檢查處置代號的內容
- df$find1=grepl(pattern = 10,x = df$combine)
- df$find2=grepl(pattern = 22,x = df$combine)
- df$find3=grepl(pattern = 231,x = df$combine)
Advertisement
Add Comment
Please, Sign In to add comment