I have a 2 lists of 6 data frames each.
listofdf_1 <- list(a, b, c, d, e, f)
listofdf_2 <- list(a2, b2, c2, d2, e2, f2)
I want to inner_join data frame a with a2, b with b2, c with c2 etc.
The join column is : ID1
I've written a function :
merge_on_id <- function(x, y, join_field) {
require(dplyr)
inner_join(x, y, by = join_field)
}
Now I'm joining one by one: merge_on_id(listofdf_1[[1]], listofdf_2[[1]], by = "ID1") etc.
I'm wondering if there is a way to join all six in a single line instead of having to repeat for each element of the list.