Hi all I have one dataframe that looks like this:
> dput(m1)
structure(list(Person_ID = c(111L, 222L, 333L), City = c("New York",
"Los Angeles", "Paris")), class = "data.frame", row.names = c(NA,
-3L))
and another that looks like this:
> dput(m2)
structure(list(Person_ID = c(111L, 222L, 333L, 444L), City = c("New York",
"Los Angeles", "Long Beach", "Amsterdam")), class = "data.frame", row.names = c(NA,
-4L))
I want to quickly extract observations that don't match. For example, we see that Person_ID 111 and Person_ID 222 have the same city in both dataframes, but Person_ID 333 does not. Also, Person_ID 444 is not represented in the 1st dataset, so they should be extracted to.
The output should look like:
> dput(m3)
structure(list(Person_ID = c(333L, 444L)), class = "data.frame", row.names = c(NA,
-2L))