Hi, I am trying to print several dataset in several different sheets of the same xlsx file. I sometimes run the codes more than once, and I need to erase all things in the target file, and I do not use "append" in the first function call. However I want to write it in a loop. Is there a way to initiate a blank xlsx file so that I can use "append = TRUE" whenever I call the function write.xlsx2?
output_file2<-"data_xx.xlsx" write.xlsx2(x= df_all2[["a"]], file = output_file2, sheetName = "a") write.xlsx2(x= df_all2[["b"]], file = output_file2, sheetName = "b", append=TRUE) write.xlsx2(x= df_all2[["c"]], file = output_file2, sheetName = "c", append= TRUE) [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.