I’m merging two data frames, a main data set and a lookup table, based on multiple factor (key) variables, and I’d like to have a quick way of seeing which combinations of these key variables in the main data did not match in the lookup table. Is there an option in the merge function that would allow me to do this? The best I can think of at the moment is to use the all.x=T option and then look at the rows for which one of the vars that I merged in is NA. Surely there must be a better way…
Here’s my code, for what it’s worth:
a.lighting.all.2 <- merge(a.lighting.all.2, a.lookup.by.meas.2,
by = c("measure.category", "measure.subcategory",
"measure", "fund.category"))
Here is a function for diff-ing two data.frames with identical headers:
So you can run: