[R] Differing rows in two data.frames?

Mark Knecht markknecht at gmail.com
Tue Aug 18 00:23:50 CEST 2009

On Mon, Aug 17, 2009 at 2:25 PM, Mark Knecht<markknecht at gmail.com> wrote:
> Hi,
>   What commands would I look at to compare row-by-row two data frames
> of the same size and print out any differences between the two?
> Thanks,
> Mark

So I got an answer using the following code:

XXX = cbind(SystemWithCP, SystemWithoutCP)
names(XXX)[14] = "NewPLPos"
YYY = subset(XXX, XXX$PL_Pos != XXX$NewPLPos)

write.csv(YYY, "C:\\Dave1.csv")

This works (I suppose) because the two data.frames are exactly the
same size. Seems like there probably a much better way to do it but
this seems to work.

- Mark

More information about the R-help mailing list