dplyr - How can I split my sheet with 3 different dataset in R -


see sample data: link

i split data above 3 different data following rule below.

  1. only have 'aid' (10 string starting "oa")
  2. only have 'cid' (14 numeric)
  3. 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

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -