[R] set differences

Sundar Dorai-Raj sundar.dorai-raj at pdf.com
Mon Sep 12 18:29:34 CEST 2005


sms13+ at pitt.edu wrote:
> Can anyone tell me how to do set 
> differences in R?
> e.g., if I have a vector 
> a<-c(1,2,3,4,5) and another vector 
> b<-c(2,5), how can I do something like 
> a/b = (1,3,4)?
> 
> Thanks!
> 

a[!a %in% b]

*or*

setdiff(a, b)

--sundar




More information about the R-help mailing list