我不希望退出时在R中清除我的全局环境

时间:2021-09-12 23:36:10

So even if I indicate "NOT" in a google search, there is literally no result for this. Everybody wants to clear their global environment. I am just starting with R so I want to keep all my data and variables so I can play around. Every time I exit R it clears the global environment unless I save the image to a work space .RData file. How can I keep all my environment in tact without have to save twice every time?

因此,即使我在谷歌搜索中指出“不”,也没有结果。每个人都希望清除他们的全球环境。我刚开始使用R所以我想保留所有数据和变量,以便我可以玩。每次我退出R它都会清除全局环境,除非我将图像保存到工作空间.RData文件。如何保持我所有的环境,而不必每次都保存两次?

1 个解决方案

#1


4  

If you use RStudio, you can just set the option "Global Options" --> "Save workspace as .RData on exit" to "Always", and the environment will be saved automatically and loaded the next time you open the same project.

如果使用RStudio,只需将“全局选项”选项 - >“退出时将工作区另存为.RData”设置为“始终”,环境将自动保存并在下次打开同一项目时加载。

AFAIK, saving to a RData file is the easiest way to save the "state" of your environment across sessions. Incidentally, if you do not want to save your objects somewhere, how can you expect to be able to retrieve them afterwards ?

AFAIK,保存到RData文件是跨会话保存环境“状态”的最简单方法。顺便提一下,如果你不想在某个地方保存你的对象,你怎么能期望能够在之后检索它们?

#1


4  

If you use RStudio, you can just set the option "Global Options" --> "Save workspace as .RData on exit" to "Always", and the environment will be saved automatically and loaded the next time you open the same project.

如果使用RStudio,只需将“全局选项”选项 - >“退出时将工作区另存为.RData”设置为“始终”,环境将自动保存并在下次打开同一项目时加载。

AFAIK, saving to a RData file is the easiest way to save the "state" of your environment across sessions. Incidentally, if you do not want to save your objects somewhere, how can you expect to be able to retrieve them afterwards ?

AFAIK,保存到RData文件是跨会话保存环境“状态”的最简单方法。顺便提一下,如果你不想在某个地方保存你的对象,你怎么能期望能够在之后检索它们?