Re: [R] efficiently diff two data frames

2013-04-19 Thread Liviu Andronic
Dear Rui, Thanks for the pointer. On Tue, Apr 16, 2013 at 8:12 PM, Rui Barradas wrote: > setdiffDF2 <- function(A, B){ > f <- function(X, Y) > !duplicated(rbind(Y, X))[nrow(Y) + 1:nrow(X)] > ix1 <- f(A, B) > ix2 <- f(B, A) > ix1 & ix2 > } > ix <- setdiffDF2(Xe, Xf) > Xe[i

Re: [R] efficiently diff two data frames

2013-04-16 Thread Rui Barradas
Hello, Maybe Petr Savicky's answer in the link https://stat.ethz.ch/pipermail/r-help/2012-February/304830.html can lead you to what you want. I've changed his function a bit in order to return a logical vector into the rows where different rows return TRUE. setdiffDF2 <- function(A, B){

[R] efficiently diff two data frames

2013-04-16 Thread Liviu Andronic
Dear all, What is the quickest and most efficient way to diff two data frames, so as to obtain a vector of indices (or logical) for rows/columns that differ in the two data frames? For example, > Xe <- head(mtcars) > Xf <- head(mtcars) > Xf[2:4,3:5] <- 55 > all.equal(Xe, Xf) [1] "Component 3: Mean