My loop is completely doing what I want it to do apart from when writing out the data I want it to loop through and open a new sheet each time, it is not doing this but simply overwriting the data in the single excel file. My code is:
file2 <- paste("filelocation", sep = "")
write.xlsx(Combined, file2, sheetName = (i))
I do not know why this isn't working as this exact same code is working for me earlier in the code.