Hi everyone. I am a complete coding newbie so I am really quite lost trying to combine CSV data sets together. After setting my required folder to the working directory, the only line of code I inserted is:
list.files(pattern=".csv")
Following this, to combine the files, I used this: do.call("rbind",lapply(files,read.csv,header=TRUE,fill=TRUE))
And this is what I get:
argument "args" is missing, with no default
I'd really appreciate any help understanding what I need to fix this!
You can use, rbind to combine files with same column headers and bindrows to combine the files with different column headers. This logic is apt for all types of files.
Ya, to be more clear and elaborate with my previous answer, we would be importing the file as dataframe, and if these dataframes are with same column headers, then we would be using rbind to combine all the dataframes. And, if the dataframes are with different column headers, then we would be using bind rows to combine all the dataframes. After combining the dataframes, we can use write_csv to write that particular combined dataframe as file. We could even use write.csv to write the dataframe as a file, but, write.csv would add an index number to the written file. So, preferably, we can use write_csv to write the combined_dataframe as a file.