简体   繁体   English

如何在同一个excel的3个excel工作表中编写3个差异数据框并保存在r中

[英]how to write 3 diff dataframe in 3 excel worksheet in the same excel and save in r

These 3 variables contain diff data frames as follows这 3 个变量包含如下差异数据帧

"ecofst" , "Successful","Failed" "ecofst" , "成功", "失败"

I want to write them in the same excel file but diff worksheet as listed above我想把它们写在同一个 excel 文件中,但是上面列出的 diff 工作表

here is a sample of how I want it to look like in the picture below这是我希望它在下图中的样子的示例

在此处输入图片说明

Suppose you have data frames called data1 and data2 in R. Then you can use the xlsx package to specify the worksheet:假设您在 R 中有名为data1data2数据框。那么您可以使用xlsx包来指定工作表:

library(xlsx)
write.xlsx(data1, "file.xlsx", sheetName = "sheet1")
write.xlsx(data2, "file.xlsx", sheetName = "sheet2")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM