Guest User

Untitled

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