This does literally what you asked for
> x[x %in% y]
[1] 2 3
This is more likely what you want
> which(x %in% y)
[1] 2 3
>
It is an artifact of this example that the two results look the same. Here
is a different example
that distinguishes them, and in this example, %in% is probably not right
ei
> x[x %in% y]
[1] 2 3
>
2012/1/8 Philipp Chapkovski :
> x<-1:11
> y<-2:3
>
> is there a way to do something like
> x[x==y]
> (which actually produce error)?
> I am really got stuck
>
--
Sarah Goslee
http://www.functionaldiversity.org
__
R-help@r-pro
x<-1:11
y<-2:3
is there a way to do something like
x[x==y]
(which actually produce error)?
I am really got stuck
__
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/
3 matches
Mail list logo