I would like to export multiple data frames from R to a single Excel sheet. By using the following code:
write.xlsx(DF1, file="C:\\Users\\Desktop\\filename.xlsx", sheetName="sheet1",
col.names=TRUE, row.names=TRUE, append=FALSE)
write.xlsx(DF2, file="C:\\Users\\Desktop\\filename.xlsx", sheetName="sheet2",
col.names=TRUE, row.names=TRUE, append=TRUE)
I can export two data frames to a single excel workbook, but in two separate sheets. I would like to export them in a single sheet, andif possible, to determine the specific cells that these data frames will be placed in.
Any suggestions more than welcome.
DF1andDF2look like? If they have the same columns you couldrbind(DF1, DF2)and then export, if they have the same rows you couldcbind(DF1, DF2)and then export. - slacklinecbind(DF1, DF2), something likeDF1$dummy <- "". - slackline