Sunday, 15 January 2012

R grep sublist from master list from dataframe -



R grep sublist from master list from dataframe -

how grep sublist of list grep -f in unix? have dataframe

a 1 3 4 b 4 5 6 c 7 8 9 d 1 3 4 e 1 3 3 f 2 4 5

and need

a 1 3 4 c 7 8 9 e 1 3 3 f 2 4 5

by grep c(a c e f) ? lot!

i'm assuming a c e f rownames. assumming info frame called dd, basic subsetting should trick:

##select rows rownames in particular vector dd[rownames(dd) %in% c("a", "c", "e", "f"), ]

r list grep

No comments:

Post a Comment