问题
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 intact without have to save twice every time?
回答1:
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.
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 ?
来源:https://stackoverflow.com/questions/45908630/i-do-not-want-my-global-environment-to-clear-in-r-on-exit