[R] Reset R to a vanilla state

Georg Ruß research at georgruss.de
Thu Dec 16 15:33:43 CET 2010


On 16/12/10 15:12:47, Holger Hoefling wrote:
> Specifically I want all objects in the workspace removed

rm(list=ls()) should do this trick.

> and all non-base packages detached and unloaded

You may obtain the list of loaded packages via

(.packages())

Store this at the beginning of your session, get the diff to the loaded
packages at the end of the session and

detach(package:packagename) those packages.

> and preferably a .Rprofile executed as well

source(".Rprofile") ?

What's the circumstance that requires you to do this? I.e. why don't you
just restart R?

Regards,
Georg.
--
Research Assistant
Otto-von-Guericke-Universität Magdeburg
research at georgruss.de
http://research.georgruss.de



More information about the R-help mailing list