Dear all,
I have a vector, and for each element I want to check whether it is equal to
any element from another vector. I want a vector of logical values with the
length of the first one as return. In R this would be :
x - 1:10
sapply(x,function(y){any(y==c(2,3,4))})
[1] FALSE TRUE TRUE
On 3/04/2010, at 11:35 AM, Joris Meys wrote:
Dear all,
I have a vector, and for each element I want to check whether it is equal to
any element from another vector. I want a vector of logical values with the
length of the first one as return. In R this would be :
x - 1:10
Hi Joris
Try Is.element function: is.element (x,y)
Regards
mohamed
Joris Meys jorism...@gmail.com a écrit :
Dear all,
I have a vector, and for each element I want to check whether it is equal to
any element from another vector. I want a vector of logical values with the
length of the first
This was actually the one I was looking for, thx. It's actually essentially
a wrapper for %in%, can't imagine I missed that one. I tried it out but I
put the vectors in the wrong order (giving a vector of length 3). Guess it's
too late to think clearly.
Cheers
On Sat, Apr 3, 2010 at 12:55 AM,
4 matches
Mail list logo