Permanently removing objects in RStudio Mac OS?

4.3k views Asked by At

Every time I started RStudio, I have seen this my working environment.

I can use rm(list=ls()) to remove them temporarily, but every time I restarted RStudio, they showed up again.

I use getwd() to see my working directory, but in the working directory, I did not see any .Rdata file. How can I get rid of these things ?

Your kind help will be well regarded.

I use Mac OS 10.10.

2

There are 2 answers

1
Barranka On

I think that you, at some point, chose to save your environment to your working directory (most likely ~, i.e. your home directory, which is the default RStudio working directory).

The easier way to clear your default environment is to remove the .RData file from your home directory. It will not appear in any Finder window, because in a Unix-like OS (like OS X), files starting with . are hidden. So do the following:

  1. Open a terminal window
  2. If not already there, go to your home folder: cd ~
  3. Check if there's an .RData file: ls -lA .RData
  4. If the file exists delete it: rm .RData (if you want, create a backup: `cp .RData ./RData_backup)
0
Garrett Thomas On

Click on RStudio in the menu bar and go to Preferences. In the R General section, unclick the Restore .RData into workspace at startup option. The default is to reload the working environment when you restart RStudio.