[R] compare 2 vectors

Alberto Monteiro albmont at centroin.com.br
Thu Jun 28 14:21:16 CEST 2007


Romain Francois wrote:
> 
> There is also a pretty useful operator %w/o% in the help page of 
> %in%. see :
> 
>  > ?`%in%`
>  > a <- c(1,2,3,4,5,6,7,8,9)
>  > b <- c(3,10,20,5,6)
>  > b %w/o% a
> [1] 10 20
> 
I don't like the example. It's not obvious, in the expression...

  x[!x %in% y]

... that this is the same as x[!(x %in% y)] and not x[(!x) %in% y]

Alberto Monteiro



More information about the R-help mailing list