I have 6 data sets. Their names are: e10_all, e11_all, e12_all, e13_all, e14_all, and e19_all.
All have different numbers of columns and rows, but with some common columns. I need to bind the rows of these columns together. First, I want to determine the columns that are common to all of the data sets. Each of these data sets has around 100 columns, so checking them one-by-one would be very tedious. I've tried a few different methods of comparing two data sets, but with no luck.
I've tried:
library(arsenal)
summary(compare(e10_all, e11_all))
library(lubridate)
setdiff(e10_all, e11_all)
c <- cbind(e10_all[, which(colnames(e10_all)%in% colnames(e11_all))],
e11_all[, which(colnames(e11_all)%in% colnames(e10_all))])
as.data.frame(lapply(intersect(names(e10_all), names(e11_all)),
function(name) e10_all[name] + e11_all[name]))
None of these give me what I want. All I need is a list of columns that are common between the two data sets. If possible I would like to compare all 6 data sets.
Thank you
common_cols <- intersect(colnames(df1), colnames(df2))