Skip to content
Prev 7498 / 15075 Next

Clear Workspace and .Rprofile

On Sun, 26 Sep 2010, Ben Haller wrote:

            
I'd say not clearing .First is a bug: the menu item executes

                 [[REngine mainEngine] executeString: @"rm(list=ls())"];

and that should be rm(list=ls(all=TRUE)).

However, if you ask the workspace to be cleared, it should be clear. 
The unanswered question is why you are using .Rprofile to create 
objects in the workspace -- sounds as if you want to put them in an 
attached environment (e.g. via a package) -- and people normally work 
hard to ensure that .Rprofile leaves no objects there.

Beyond that, one could question the need for a 'Clear Workspace' menu 
item.  It does not start a new session and there are some many 
stateful variables (e.g. the search() path) not part of the workspace 
that starting a new session is much more common.