在R中保存数据文件 [英] saving a data file in R
本文介绍了在R中保存数据文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已成功将.txt文件加载到R中.我想保存数据,以便可以实际使用它.保存文件的命令是什么?我是将文件保存到现有软件包之一(UsingR,MASS)中,还是将其保存为单独的文件?
I have successfully loaded a .txt file into R. I want to save the data so I can actually actively use it. What is the command for saving a file? Will I save the file to one of the existing packages (UsingR, MASS), or just as a separate file?
推荐答案
您要查找的命令是以下任一命令:
The command you look for is either one of these :
-
save()
:将提到的对象另存为R个对象(扩展名.RData).这些文件是二进制文件,可以使用load()
再次快速读取.
-
write()
:是cat()
的包装,用于从对象(通常是矩阵)创建文本文件. -
write.table()
和write.csv()
:是用于使用特定分隔符将数据帧写为文本文件的命令.
save()
: saves the mentioned objects as R objects (extension .RData). These files are binary and can be read very quickly again withload()
write()
: is a wrapper forcat()
and is used to create text files from objects, usually matrices.write.table()
andwrite.csv()
: are commands to write data frames as text files with a specific separator.
还请检查sink()
,用于将其他输出重定向到文件(通常用于记录目的).
Check also sink()
, used to redirect other output to a file (usually used for logging purposes).
请阅读R的手册:
http://cran.r-project.org/doc/manuals/R-intro.pdf
http://cran.r-project.org/other-docs.html
相关问题:
- Save a file interactively?
- Saving a data frame as a binary file
- How do you sink input and output to a text file in R?
这篇关于在R中保存数据文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文