I have two data frames (x
and y
).
When I need to join data, one of the first things I do is to look and see what the common column (field) names are for any obvious ones (such as x$id
and y$id
).
I can check to see how many columns x
and y
share like this:
library(dplyr)
colnames(x) %in% colnames(y) %>% table
Which gives:
> colnames(x) %in% colnames(y) %>% table
.
FALSE TRUE
5 12
However, how can I list the names of the matching columns to see which ones they are?