[英]R: How to get rid of default data and values stored in global environment
Every time I open my laptop R, the same data and values (data tables and variables I used in the past) keep on appearing, and it's annoying to rm()
them every time I open a new file to work on something else.每次我打开笔记本 R 时,相同的数据和值(我过去使用的数据表和变量)不断出现,每次打开新文件处理其他事情时,
rm()
它们很烦人。 My question is: 1) Is there a way to reset or set default data and variables in global environment?我的问题是:1)有没有办法在全局环境中重置或设置默认数据和变量? For example, if I'm working on
file1
, I want to use data table data1
, data2
, and data3
and variable v1
, v2
, and v3
.例如,如果我正在处理
file1
,我想使用数据表data1
、 data2
和data3
以及变量v1
、 v2
和v3
。 It'd be nice if I can store these set of data and variables for file1
specifically and simply call them instead of loading the data and running the codes every time I open the file.如果我可以专门为
file1
存储这些数据和变量集,并且只需调用它们而不是每次打开文件时加载数据和运行代码,那就太好了。
Thank you!谢谢!
In RStudio, press the button with the broom icon to remove all objects from the environment.在 RStudio 中,按下带有扫帚图标的按钮可从环境中移除所有对象。 Include hidden objects.
包括隐藏的对象。 Then, quit RStudio and make sure to save the workspace image to ~/.Rdata.
然后,退出 RStudio 并确保将工作区图像保存到 ~/.Rdata。 This should fix your problem.
这应该可以解决您的问题。 When you open RStudio again, the Global Environment should be empty.
再次打开 RStudio 时,全局环境应该是空的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.