I have an ordered "set" of numbers, represented by a vector, say

  > X <- c(10:13, 17,18)
  > X
  [1] 10 11 12 13 17 18

then I have a "sub-set" of X, say

  > Y <- c(11,12,17,18)

Is there a simple way in R to have a logical vector (parallel to X) indicating 
what elements of X are in Y, i.e.,

  > Inclusion
  [1] FALSE TRUE TRUE FALSE TRUE TRUE

I'm trying to avoid looping over both vectors to produce the tests. Do you have 
any comments on this?

Thanks,

--Sergio.

______________________________________________
R-help@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.

Reply via email to