n Behalf Of
Petr Savicky [savi...@praha1.ff.cuni.cz]
Sent: Sunday, April 24, 2011 5:13 AM
To: r-help@r-project.org
Subject: Re: [R] Matching a vector with a matrix row
On Sat, Apr 23, 2011 at 08:56:33AM +0800, Luis Felipe Parra wrote:
> Hello Niels, I am trying to find the rows in Matrix whic
On Sat, Apr 23, 2011 at 08:56:33AM +0800, Luis Felipe Parra wrote:
> Hello Niels, I am trying to find the rows in Matrix which contain all of the
> elements in LHS.
This sounds like you want an equivalent of
all(LHS %in% x)
However, in your original post, you used
all(x %in% LHS)
What is c
arra [felipe.pa...@quantil.com.co]
Sent: Friday, April 22, 2011 8:56 PM
To: Niels Richard Hansen
Cc: r-help
Subject: Re: [R] Matching a vector with a matrix row
Hello Niels, I am trying to find the rows in Matrix which contain all of the
elements in LHS.
Thank you
Felipe Parra
On Fri, Apr 22, 2
Hello Niels, I am trying to find the rows in Matrix which contain all of the
elements in LHS.
Thank you
Felipe Parra
On Fri, Apr 22, 2011 at 10:30 PM, Niels Richard Hansen <
niels.r.hansen+li...@math.ku.dk> wrote:
> Joshua and Luis
>
> Neither of you is exactly solving the problem as stated, se
Joshua and Luis
Neither of you is exactly solving the problem as stated, see
below. Luis, could you clarify if you want rows that are _equal_
to a vector or rows with entries _contained_ in a vector?
If
m <- matrix(c("A", "B", "C", "B", "A", "A"), 3, 2)
LHS <- c("A", "B")
then LHS equals the f
Hi Felipe,
Since matrices are just a vector with dimensions, you could easily use
something like this (which at least on my system, is slightly faster):
results <- which(Matrix %in% LHS)
I'm not sure this is the fastest technique thought. It will return a
vector of the positions in "Matrix" tha
Hello I am trying to compare a vector with a Matrix's rows.The vector has
the same length as the number of columns of the matrix, and I would like to
find the row numbers where the matrix's row us the same as the given vector.
What I am doing at the moment is using apply as follows:
apply(Matrix,1
7 matches
Mail list logo