I have a for loop that reads a list of .csv files, cleans them, and exports the output as a new .csv file. Before outputting the .csv file, I want to add the clean data frame to a list of some sort, so that at the end of the process (there are about 36 .csv files I am cleaning inside the for loop) I can combine all of the cleaned data frames into one single large data frame to be exported as a .csv.
Here is an example of the empty list I initialized at the beginning of the code (before the loop):
csv_list <- vector(mode = "list", length = 36)
When I run the loop, the data frames are not appended as intended. Instead of adding onto the existing columns (the data has the same row and column names, just different values) the list is simply filled with the column names in place of the rows, and vice versa.
Am I using lists incorrectly? Another thought I had was to create an empty data frame and simply merge the cleaned data frames to the empty one each time the loop runs through.
I have no preference for base R, dplyr, etc. Any help would be appreciated.