[R] Reset R to a vanilla state
Marc Schwartz
marc_schwartz at me.com
Thu Dec 16 16:57:35 CET 2010
If you are using Emacs/ESS/org-mode etc., you may be better of posting to the ESS-Help list, where there are folks that I know of who are engaged in using org-mode for R coding and documentation. They may be able to offer some insights into their practices.
More info at:
https://stat.ethz.ch/mailman/listinfo/ess-help
HTH,
Marc Schwartz
On Dec 16, 2010, at 9:49 AM, Holger Hoefling wrote:
> Hi,
>
> I am writing code in Emacs using org-mode and babel. I have a number of code
> blocks that are tangled into several files with some files spanning several
> code blocks. Each of these files is supposed to run independently of each
> other on a clean version of R, however I also want to be able to execute
> each code block during the org-mode development. This means
>
> a) I cannot use a new R session in every code block
> b) I cannot reuse the same R session for all code-blocks without cleaning it
> up
> c) Quitting and restarting R is not an option
>
> Thank you very much for your suggestions for cleaning the workspace. It is a
> partial solution, but doesn't guarantee a vanilla state (i.e. inadvertently
> changed options and the like). I was hoping for a base-package function that
> guarantees this functionality, but will probably use the ad-hoc version of
> cleaning the workspace and the packages only if no-one knows anything
> else....
>
> Thank you very much for your suggestions again.
>
> Best
>
> Holger
>
> On Thu, Dec 16, 2010 at 3:33 PM, Georg Ruß <research at georgruss.de> wrote:
>
>> 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.
More information about the R-help
mailing list