[R] Use "append" in the function write.xlsx2 or write.xlsx (openxlsx package)

jpm miao miaojpm at gmail.com
Tue May 3 05:21:20 CEST 2016


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]]



More information about the R-help mailing list