The program browse through all the files in a folder, process them and rbind them in a single file :
files=list.files(path="path", recursive=T, pattern='.xlsx')
for(i in 1:length(files))
{
#some process goes which generates qs_30 for each file as the loop is run
if (!exists("dataset")){
dataset <- qs_30
}
# if the merged dataset does exist, append to it
if (exists("dataset")){
temp_xts <-qs_30
dataset<-rbind(dataset, temp_xts)
rm(temp_xts)
}
}
When the final dataset file is written it duplicates the entries of the first qs_30. Please help in debugging this.