I have a list of different data frame, just a general example:
x <- data_frame(i = c("a","b","c"), j = 1:3)
y <- data_frame(i = c("b","c","d"), k = 4:6)
z <- data_frame(i = c("c","d","a"), l = 7:9)
list(x,y,z)
I want to find the rows that are common in the different couples (xy, yz, xz) and in xyz, and the one there are unique in x, y, z.
I want to find some fast way to code it.
I read other thread here and I find this in a similar question:
list(x,y,z) %>%
Reduce(function(dtf1,dtf2) left_join(dtf1,dtf2,by="i"), .)
And I tried:
list(x,y,z) %>%
Reduce(function(x,y) anti_join(x,y, by="i"), .)
which is giving me back the rows present in x but not in y, meaning that I have write a similar line for each couple and then inner_join the results.
there is a better way?