Dear all,
this looks pretty much a standard problem, but I couldn't find a
satisfying and understandable solution.
(A) Given a data frame (or matrix), e.g.
x - data.frame(A=c(1, 2, 2), B=c(4, 5, 5))
and a row of this data frame, e.g.
r - c(2, 5)
I need to find one row
Mirko,
Here is a solution - I am sure other R mentors would find a more efficient
one
x - data.frame(A=c(1, 2, 2), B=c(4, 5, 5))
x - rbind(x,x)
r - c(2,5)
(rowfind=apply(x,1,FUN=function(row,add){isTRUE(all.equal(row,add,check.attributes
= FALSE))},add=r))
1 2 3 4 5 6
FALSE TRUE TRUE
rows - which(apply(mapply(x, r, FUN===), MARGIN=1, FUN=all));
/H
On Thu, Nov 25, 2010 at 1:59 AM, Luedde, Mirko mirko.lue...@sap.com wrote:
Dear all,
this looks pretty much a standard problem, but I couldn't find a
satisfying and understandable solution.
(A) Given a data frame (or matrix),
Hi all, thank you for quick help.
Any ideas on (better) efficiency
(with other data types)?
Best, Mirko
-Ursprüngliche Nachricht-
Von: henrik.bengts...@gmail.com [mailto:henrik.bengts...@gmail.com] Im Auftrag
von Henrik Bengtsson
Gesendet: Donnerstag, 25. November 2010 11:25
An:
Try this:
which((apply(x, 1, toString) %in% toString(r)))
On Thu, Nov 25, 2010 at 7:59 AM, Luedde, Mirko mirko.lue...@sap.com wrote:
Dear all,
this looks pretty much a standard problem, but I couldn't find a
satisfying and understandable solution.
(A) Given a data frame (or matrix), e.g.
On Thu, Nov 25, 2010 at 4:59 AM, Luedde, Mirko mirko.lue...@sap.com wrote:
Dear all,
this looks pretty much a standard problem, but I couldn't find a
satisfying and understandable solution.
(A) Given a data frame (or matrix), e.g.
x - data.frame(A=c(1, 2, 2), B=c(4, 5, 5))
and a
6 matches
Mail list logo