导出到R中现有的Excel工作表

时间:2018-08-26 08:26:56

标签: r excel

是否可以将数据框导出到现有的Excel工作表?例如,我试图将一个名为aus的数据框导出到一个名为“ AUS + USA”的现有工作表名称。

我的方法:

write.xlsx2(aus, "Mission Performance Graphs.xlsx", sheetName="AUS + USA", 
            col.names=TRUE, row.names=FALSE, append=TRUE)

谢谢!

1 个答案:

答案 0 :(得分:0)

尝试这种代码

# R format to Excel sheet
library("xlsx")
write.xlsx(x=aus[[1]], "Mission Performance Graphs.xlsx", row.names = FALSE, sheetName = "AUS")
writte.xlsx(x=aus[[2]], "Mission Performance Graphs.xlsx", row.names = FALSE, sheetName = "USA", append = TRUE)

#Use getwd() to see where the file is located
getwd()