Is there a tidyverse way to join a list of data frames?
I have a list of data.frames as a result of a call to map().
I have used reduce() to do something like this before, but I want to merge them as apart of pipeline. Consider the below example for reference:
library(tidyverse)
#Function to make a data.frame with an ID column and a random variable column with mean = data_mean
make.df <- function(data_mean){
data.frame(id = 1:50,
x = rnorm(n = 50, mean = data_mean))
}
# What I want:some function that will full_join() on a list of data frames?
my.dfs <- map(c(5, 10, 15), make.df)
## Gives me the result I want but not so clean
my.dfs.joined <- full_join(my.dfs[[1]], my.dfs[[2]], by = 'id') %>%
full_join(my.dfs[[3]], by = 'id')
## This gives what I want but I don't want to bind. Instead I want to merge
my.dfs.bound <- map(c(5, 10, 15), make.df) %>%
bind_cols()