如何在R中的一个csv excel文件的多个工作表中写入多个数据框? [英] how to write multiple dataframe to multiple sheet of one csv excel file in R?

查看:172
本文介绍了如何在R中的一个csv excel文件的多个工作表中写入多个数据框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将多个数据帧写入单个csv格式的文件,但每个文件都放在excel文件的不同工作表中:

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)

有什么方法可以在此代码中指定工作表以及csv文件,并将它们全部写入一个文件中吗?

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

先谢谢您

推荐答案

这是不可能的.这就是csv的功能,它只在一张纸上,因此您可以从记事本或任何其他此类软件中查看它.如果您仍然尝试写,那将成为徒劳.只需尝试打开一个csv并打开一个新工作表,然后编写一些值并保存即可.已经存在的值将被删除.一个csv格式的excel文件只能包含一张纸.

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.

这篇关于如何在R中的一个csv excel文件的多个工作表中写入多个数据框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆