Use %in% indeed of '=='
a[a[,1] %in% b,]
On 09/03/2008, Waverley <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a matrix
> a = matrix (1:16, 4, 4)
> b = c (2,3)
>
> I want to find out which rows of a, where a[,1] equals any values of b?
>
> I know that if b is only one value, e.g, b=2, then what I
Hi,
I have a matrix
a = matrix (1:16, 4, 4)
b = c (2,3)
I want to find out which rows of a, where a[,1] equals any values of b?
I know that if b is only one value, e.g, b=2, then what I want is a[a[,1] == 2,]
But what about if it is not one value but a vector of values?
Thanks much in advance.
2 matches
Mail list logo