Hi James, Here is another option: all.equal() is more general, the sapply() option I wrote assumes both data frames are basically the same, but that maybe a few elements are different (e.g., you have two data sets and are not sure which is more recent).
y <- x <- iris # x & y copies of iris ## change 15 elements from a random column y[sample(150, 15), sample(4, 1)] <- 99 all.equal(x, y) # using all.equal x[sapply(1:ncol(x), function(z) {x[, z]!=y[, z]})] Cheers, Josh On Tue, Nov 23, 2010 at 9:17 AM, Jim Edd Jones <jejones...@comcast.net> wrote: > Is it possible to use R to compare two datasets to look for discrepancies, as > one would with the SAS procedure PROC COMPARE? > > Any help on this would be greatly appreciated. > > James E. Jones > 135 Salina St. > Lafayette, CO 80026 > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. > -- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.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.