简体   繁体   English

替换.Rdata文件中的数据

[英]Replacing data in .Rdata file

Is there a way I could replace the table in .Rdata file with another one? 有没有办法可以将.Rdata文件中的表替换为另一个? I can edit it with edit(x) command, but it would take an enormous amount of time to do this manually; 我可以使用edit(x)命令对其进行编辑,但手动执行此操作需要花费大量时间。 besides, I haven't found a way to add rows to it. 此外,我还没有找到一种方法来添加行。

I think you need to read a few 'intro to R' guides. 我想你需要阅读一些“R简介”指南。

A .Rdata file is generally a saved session, and can have any number of 'things' saved in it, scalars, vectors, data.frames, lists, functions etc etc. I assume you have a data file that has been read into R into a data.frame and that is saved within a .Rdata file. .Rdata文件通常是一个保存的会话,可以保存任意数量的“东西”,标量,向量,数据,帧,列表,函数等。我假设你有一个数据文件已被读入R到data.frame并保存在.Rdata文件中。 You can load the .Rdata file with load("....Rdata") then you can 'replace' your table (a data frame), by loading another one over top, if that's what you want to do, so assuming it's called dat, dat <- read.csv("new_data.csv", ...) , and then save the session again, save.image("....Rdata") . 您可以使用load("....Rdata")加载.Rdata文件然后您可以“替换”您的表(数据框),通过在顶部加载另一个,如果这是您想要做的,那么假设它是称为dat, dat <- read.csv("new_data.csv", ...) ,然后再次保存会话, save.image("....Rdata") I've assumed a lot of things there though... 我已经假设了很多东西......

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

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