I'm reading from multiple csv files in a loop, and performing some calculations on each file's data, and then I wish to add that new row to a data frame:
for (i in csvFiles) {
fileToBeRead<-paste(directory, i, sep="/")
dataframe<-read.csv(paste(fileToBeRead, "csv", sep="."))
file <- i
recordsOK <- sum(complete.cases(dataframe))
record.data <- data.frame(monitorID, recordsOK)
}
So, I want to add file and recordsOK as a new row to the data frame. This just overwrites data frame every time, so I'd end up with the data from the latest csv file. How can I do this while preserving the data from the last iteration?