I am trying to merge all csv-files in one folder into one data frame in R. Merging should be based on the id variable which is always the first column in the file.
My code so far:
Get list of all files in one folderfile_list = list.files(pattern="*.csv")
Put all files into one list
myfiles = lapply(file_list, read.delim)
Merge all files
merged.files <- Reduce(function(x, y) merge(x, y, all=TRUE), myfiles)
How can I tell Merge to always use the first column for merging ("by = "first column"") while the column names are always different in each file?
Thanks for your help.