[R] Logical "and"

Sean Davis sdavis2 at mail.nih.gov
Thu Nov 11 14:42:30 CET 2004


On Nov 11, 2004, at 8:33 AM, Alexander Sokol wrote:

> Say I have two vectors,
>
> a<-c(1,7,4,5,9,11)
> b<-c(7,4,9)
>
> I would like to create a vector containing the elements in a which are 
> not in
> b.

 > a[!(a %in% b)]
[1]  1  5 11

Sean




More information about the R-help mailing list