How can I clear everything in my global environment?

I'm convinced my global environment is haunted because I cannot clear it. Ever data frame or object I've ever made reloads every time I try to open R. How can I clear my global environment??

Believe me when I say that I've tried every solution I've been able to find on. Here's the main thread that I was referring to: How to clear the R environment.

Here's the list of things I've tried that haven't worked:

  • Ctrl-Shift-F10
  • Used the rm() - on every object
  • Changed my settings under tools -> global options -> workspace -> never restore
  • The little broom at the top of the global environment that says "confirm remove objects."
  • Uninstalled and reinstalled R and R Studio
  • Even if I start my session with using rm() to remove everything, the moment I try to load the data frame I actually need, EVERYTHING comes back.
  • Made sure I wasn't working with in a project that might be preserving all of this.

The more data frames I have in my global environment, the slower R is running and I most of the objects that are there, I don't even need anymore. I'm honestly at a loss. Please help??

What method of loading are you using ?

So I've been deleting all the data frames using rm(). Then I use load("df.Rda") to load the specific one I need, and it loads them all. The roundabout way I've been doing this is to remove all the data frames except the one I need and working on it. But when close and re-open R next time, everything comes up. I'm just hoping there's a more permanent solution. Does that help?

Probably you saved many dafatframes into df.Rda
And you should try to save only the frame of interest. Try the saveRDS function

Okay I will try that.Thanks! So even if I remove and don't load the df.Rda in question, how do I get it to stop loading every time I open up R? This is happening upon loading R and before I can even use the load() command.

Perhaps you have a .Rprofile running commands ?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.