Hello, > > In fact, the only three unique rows are these ones: > > Product Price Nbr.Lots > Cocoa 2440 5 > Cocoa 2450 1 > Cocoa 2440 6 >
The code below doesn't give the three in one step. (ixmat <- apply(reported, 1, function(x) apply(exportfile, 1, function(y) any(x != y)))) reported[apply(ixmat, 2, all), ] exportfile[apply(ixmat, 1, all), ] But it does give all three. Problem: it's inefficient. If n1 <- nrow(reported) and n2 <- nrow(exportfile), to form the index matrix alone it will make ncol times n1*n2 comparisons. And the matrix dims are n1, n2 ... Anyway, I hope it gives ideas, Rui Barradas -- View this message in context: http://r.789695.n4.nabble.com/compare-two-data-frames-of-different-dimensions-and-only-keep-unique-rows-tp4425379p4425605.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.