[Rd] Speed-up/Cache loadNamespace()

Gabriel Becker g@bembecker @end|ng |rom gm@||@com
Tue Jul 21 01:31:04 CEST 2020


Mario, Abby, et al.

Note that there is no fully safe way of unloading packages which register
methods (as answered by Luke Tierney here:
https://bugs.r-project.org/bugzilla/show_bug.cgi?id=16644 ) which makes the
single R session running arbitrary different scripts thing pretty iffy over
the long term. Even swtichr (which tries hard to support something based on
this) only gets "pretty close".

If the scripts are always the same (up to bugfixes, etc) and most
importantly require the same loaded packages then the above won't be an
issue, of course. Just something to be aware of when planning something
like this.

Best,
~G

On Mon, Jul 20, 2020 at 2:59 PM Abby Spurdle <spurdle.a using gmail.com> wrote:

> Thank you Serguei and Gabor.
> Great suggestions.
>
> > If your R scripts contain "stop()" or "q('yes')" or any other error, it
> > will end the Rscript process. Kind of watch-dog can be set for automatic
> > relaunching if needed.
>
> It should be possible to change the error handling behavior.
> From within R:
>
>     options (error = function () NULL)
>
> Or something better...
>
> Also, it may be desirable to wipe the global environment (or parts of
> it), after each script:
>
>     remove (list = ls (envir=.GlobalEnv, all.names=TRUE) )
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

	[[alternative HTML version deleted]]



More information about the R-devel mailing list