[R] Remove several numbers from a sequence

penguins catrsw at bas.ac.uk
Mon Aug 20 13:14:38 CEST 2012


Hi!

Both yy[!(yy %in% xx)] and yy[is.na(match(yy,xx))] work a treat!

Developing this topic can anyone tell me how to extract rows which are not
replicated across 2 data frames. For example:

z1<-c(1,2,3,4)
z2<-c(5,6,7,8)
zz<- data.frame(cbind(z1,z2))

x1<-c(3,4)
x2<-c(7,8)
xx<- data.frame(cbind(x1,x2))

so the result would be:

1   5
2   6

Using setdiff(xx,zz) I can get the replicated rows but not the unique ones,
and setdiff(zz,xx) returns the all rows.

Many thanks







--
View this message in context: http://r.789695.n4.nabble.com/Remove-several-numbers-from-a-sequence-tp4640630p4640771.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list