i'm trying to read csv files into data frames in R. I've already managed to cycle through defined folders, read the csv files and assign them in order to create a dataframe with the name. However, i cant seem to append data if a dataframe already exists. If a dataframe already exists i want to append the new data on the bottom and not just replace the whole thing.
This is what i have working so far:
fileName <- list.files("\\path\\subfolder", "*csv", full.names = FALSE)
fileName <- gsub(".csv", "", fileName)
for (i in 1:length(testPath)) {
tempVar <- read.csv(testPath[i])
assign(fileName[i], tempVar)
}
This only cycles through one folder, I know how to make it cycle through multiple folders. However when I run this code twice it will not append data to the dataframes, instead just create them again from a csv
Thanks for the help!
UPDATE: I FIGURED IT OUT SEE BELOW