简体   繁体   English

如何在R中的一个csv excel文件的多个表中写入多个数据帧?

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

I am trying to write multiple dataframe to a single csv formated file but each in a different sheet of the excel file: 我正在尝试将多个数据帧写入单个csv格式的文件,但每个文件都放在excel文件的不同工作表中:

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? 有什么办法可以在此代码中指定工作表以及csv文件并将它们全部写入一个文件中?

thank you in advance, 先感谢您,

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. 这就是csv的功能,它只在一张纸上,因此您可以从记事本或任何其他此类软件中查看它。 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. 只需尝试打开一个csv并打开一个新工作表,然后编写一些值并保存即可。 The values which were already there is erased. 已经存在的值将被删除。 one excel file in csv format can have only one sheet. CSV格式的一个excel文件只能包含一张纸。

xlsx和XLConnect软件包也可以解决问题。

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

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