[Rd] Stop packages and datasets to be loaded on startup.
Guillaume Yziquel
guillaume.yziquel at citycable.ch
Sun Jan 31 19:01:36 CET 2010
Dirk Eddelbuettel a écrit :
>
> | I've been looking at littler's code (so this is partly a question to
> | Dirk Eddelbuettel...):
>
> Credit where credit is due. Littler is a project by Jeff Horner and myself
> building on Jeff's work with rapache which is another industry-strength use
> of embedding of the R engine.
No harm intended.
> | > /* We don't require() default packages upon startup; rather, we
> | > * set up delayedAssign's instead. see autoloads().
> | > */
> | > if (setenv("R_DEFAULT_PACKAGES","NULL",1) != 0){
> | > perror("ERROR: couldn't set/replace R_DEFAULT_PACKAGES");
> | > exit(1);
> | > }
> |
> | The code above happens before Rf_initEmbeddedR in littler.
> |
> | So I gather that just setting R_DEFAULT_PACKAGES to NULL should be OK.
>
> Yes, see Simon's reply.
>
> | But then, what is the rather complicated stuff in the autoload()
> | function in littler.c for?
>
> We load what we need for littler. And nothing more. See autoloads.h which is
> autogenerated by make using autoloads.R during the build process.
I had a look at help(Autoload):
> On-demand Loading of Packages
>
> Description:
>
> ‘autoload’ creates a promise-to-evaluate ‘autoloader’ and stores
> it with name ‘name’ in ‘.AutoloadEnv’ environment. When R
> attempts to evaluate ‘name’, ‘autoloader’ is run, the package is
> loaded and ‘name’ is re-evaluated in the new package's
> environment. The result is that R behaves as if ‘file’ was loaded
> but it does not occupy memory.
>
> ‘.Autoloaded’ contains the names of the packages for which
> autoloading has been promised.
But I do not understand a few things about it:
-1- If I do not want autoloading, I should simply remove the
.AutoloadEnv environment? Or keep it empty?
-2- How is this environment populated at startup? How can I ensure that
it be empty?
> | And concerning datasets, how do you avoid loading them?
>
> Maybe by not loading the datasets package? But note that packages may fail
> their examples.
Thanks a lot.
--
Guillaume Yziquel
http://yziquel.homelinux.org/
More information about the R-devel
mailing list