[R] Extracting subset of a vector

Daniel Malter daniel at umd.edu
Sat Oct 11 21:35:17 CEST 2008


Hi Megh,

two options:

x=1:20
y=1:10
z1=x[x%in%y==FALSE]
z2=x[x!=y]
z1
z2

Cheers,
Daniel  


-------------------------
cuncta stricte discussurus
-------------------------

-----Ursprüngliche Nachricht-----
Von: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Im
Auftrag von Megh Dal
Gesendet: Saturday, October 11, 2008 3:26 PM
An: r-help at stat.math.ethz.ch
Betreff: [R] Extracting subset of a vector

I have 2 vecros :
x<-c(100,96,88,100,100,96,80,68,92,96,88,92,68,84,84,88,72,88,72,88)
x1 = sample(x, 5, replace=FALSE)

Now i want to get remaining values of vector "x" those are not member of
vector "x1". Can anyone please tell me how to do that?

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list