how to write multiple dataframe to multiple sheet of one csv excel file in R?

无人久伴 提交于 2020-03-27 17:34:01

问题


I am trying to write multiple dataframe to a single csv formated file but each in a different sheet of the excel file:

write.csv(dataframe1, file = "file1.csv",row.names=FALSE)
write.csv(dataframe2, file = "file2.csv",row.names=FALSE)

is there any way to specify the sheet along with the csv file in this code and write them all in one file?

thank you in advance,


回答1:


This is not possible. That is the functionality of csv to be just in one sheet so that you can view it either from notepad or any other such software. If you still try to write it would get over ridden. Just try to open a csv and open a new sheet and just write some values and save it. The values which were already there is erased. one excel file in csv format can have only one sheet.




回答2:


The xlsx and XLConnect packages will do the trick as well.



来源:https://stackoverflow.com/questions/26989917/how-to-write-multiple-dataframe-to-multiple-sheet-of-one-csv-excel-file-in-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!