I'm looking for a scalable method to multiple data frames together, on this condition that the first column matches, while also maintaining the column names which are different for each dataframe.
In this example there are only three data frames, but I'm working with a couple hundred, so am trying to write code that is scalable.
To provide context, the data files are being read from a folder, and I have a for loop to iterate through the files.
files <- list.files(path = "Documents/")
df <- list()
for (i in 1:length(files)) {
   df[[i]] <- read.csv(paste0("Documents/",files[i]))
   # code to perform action goes here
}
Below are the sample inputs and the intended output--
This is df[[1]]
date    blue
1/1/11  5
1/1/12  6
2/1/13  2
This id df[[2]]
date    orange
1/1/11  2
1/1/12  5
2/1/13  2
This is df[[3]]
date    red
1/1/11  4
2/1/13  2
This is the intended output:
date    blue    orange  red
1/1/11  5       2       4
1/1/12  6       5       NA
2/1/13  2       2       2
 
     
     
    