Hi,
On Jul 22, 2009, at 3:39 PM, Jorge Ivan Velez wrote:
Dear Michael,
Take a look at ?"%in%" This is an example:
set.seed(123)
x <- sample(0:9,10)
y <- c(2,3)
which(x %in% y)
# [1] 1 3
In addition to the above, you can also use the `match` function:
match(c(2,3), x)
[1] 1 3
The problem is that if you have repeat elements in x, it will only
return you the index of the first match in x.
-steve
--
Steve Lianoglou
Graduate Student: Physiology, Biophysics and Systems Biology
Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact
______________________________________________
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.