dplyr - How can I split my sheet with 3 different dataset in R -
i split data above 3 different data following rule below.
- only have 'aid' (10 string starting "oa")
- only have 'cid' (14 numeric)
- have nothing ('-', na , etc)
i tried use dplyr
couldn't find right solution.
change column char
as.character(data3$aid) as.character(data3$cid)
use dplyr filter
library(dplyr) q1 <- data3 %>% filter(nchar(data3$aid) >= 10) q2 <- data3 %>% filter(nchar(data3$cid) >= 14) q3 <- data3 %>% filter(nchar(data3$aid) < 10 & nchar(data3$cid) < 14)
okay, i'm done
Comments
Post a Comment