[R] filter data

arun smartpink111 at yahoo.com
Wed Mar 12 15:45:26 CET 2014


Hi,
This is not clear.  May be this helps:
dat <- read.table(text="cid cname
 101 us
 102 uk
 103 gm
 104 NA
 105 SA
 106 fr
 102 us
 104 fr
 105 gm
 101 uk
 102 us
 106 SA
 103 gm
 105 SA
 101 us
 106 fr",sep="",header=TRUE,stringsAsFactors=FALSE) 
 lst1 <- split(dat,list(dat$cid,dat$cname),drop=TRUE)
lst1[[3]]
#   cid cname
#3  103    gm
#13 103    gm

A.K.


hi users,
how to filter in cname wise and cid wise useing function  plz......give me some idea's
cid cname
101 us
102 uk
103 gm
104 NA
105 SA
106 fr
102 us
104 fr
105 gm
101 uk
102 us
106 SA
103 gm
105 SA
101 us
106 fr



More information about the R-help mailing list