Quantcast
Channel: Active questions tagged set-difference - Stack Overflow
Viewing all articles
Browse latest Browse all 36

Comparing differences between two dataframes in R

$
0
0

I'm following the solution provided in Determining different rows between two data sets in R but the R code doesn't seem to work (getting no results) and I'm not sure why. Can someone help to explain what I have done wrong here?

df1 <- data.frame(id=c("632592651","633322173","634703802","634927873","635812953","636004739","636101211","636157799","636263106","636752420"),        text=c("asdf","cat","dog","mouse","elephant","goose","rat","mice","kitty","kitten"))df2 <- data.frame(id=c("632592651","633322173","634703802","634927873","635812953","636004739","636101211","636157799","636263106","636752420","636809222","2004722036","2004894388","2005045755","2005535472","2005630542","2005788781","2005809679","2005838317","2005866692"),        text=c("asdf_xyz","cat","dog","mouse","elephant","goose","rat","mice","kitty","kitten","tiger_xyz","lion","leopard","ostrich","kangaroo","platypus","fish","reptile","mammals","amphibians_xyz"))diff1 <- df1[setdiff(df1$refid, df2$refid),]diff2 <- df2[!(intersect(df2$refid, df1$refid)),]

Viewing all articles
Browse latest Browse all 36

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>