I'm having trouble combining 40 different csv files into one. They all have the same variables var 1 var2 and id. but when I combine them I get 2 columns with all the variables in one column. I'm not sure why this is happening, this is my code:
#Combine all files into one file
final = list.files(pattern="*.csv")
for (i in 1:length(final)) {
assign(final[i], read.csv(final[i]))
}
allfiles = lapply(final,read.delim)
#Have to install plyr and reshape packages for rbind.fill
#Bind matrices by row and fill in missing columns with NA
FilledFiles <- do.call(rbind.fill, allfiles)
#Save combined dataset as Final_Data
write.csv(FilledFiles, file="Final_Data.csv")