I am using writexl package in R to export data frames to excel sheet.
library(writexl)
However when I use the following code the new data frame (resordered2) replaces the existing excel sheet instead of exporting into the new sheet (Sheet2) as specified in the code.
write_xlsx( list (Sheet2 = resordered2), "C:\\Users\\Bharath\\Desktop\\fastqc\\write.xlsx", col_names = TRUE)
The only way I can see around this issue to create all the date frames at once and list them all under the list argument.
I preferably want to work on one data frame after the other. Is there a way to avoid overwriting the existing sheet and adding a new sheet to the excel file using the write_xlsx function?