[R] vector help

David Winsemius dwinsemius at comcast.net
Thu Dec 10 21:29:14 CET 2009


On Dec 10, 2009, at 2:55 PM, Ramya wrote:

>
> I have tow vectors one is the subset of another
>
> x is a subset of X Both are vectors with n elements
>
> X[X %in% x] would give me x again rite because it is a subset but i  
> want all
> those are not in x from X.
>
> X[which(X != x)] should this do that

Perhaps you think R _should_ read your mind, but we are not there yet.  
Try instead:

X[!(X %in% x)]
>
--

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list