[Rd] No more autload() calls in .First.sys() ?

Jeffrey Horner jeff.horner at vanderbilt.edu
Wed Sep 13 17:40:27 CEST 2006


Jeffrey Horner wrote:
[...]
> This raises an interesting topic for me:
> 
>   In R-2.3.1, .First.sys() autloads() a few functions from the various 
> default packages (utils, stats, methods, graphics) IF those packages 
> weren't specified in the default packages option (or the environment 
> variable R_DEFAULT_PACKAGES). For instance, if a user doesn't want the 
> utils package automatically loaded, then .First.sys() does this:
> 
>      sch <- search()
>      if(! "package:utils" %in% sch) {
>          autoload("example", "utils")
>          autoload("methods", "utils")
>          autoload("str", "utils")
>      }
> 
> which will automagically load utils if a call to example, methods, or 
> str is made (why just those three? why not others in utils). I presume 
> there was some heuristic to determine exactly which functions were 
> autoloaded.

To answer this, all I had to do is look at the subversion log:
-------------------------------------------------------------------------
r27733 | ripley | 2003-12-21 04:21:33 -0600 (Sun, 21 Dec 2003) | 3 lines

allow all the standard examples to run with R_DEFAULT_PACKAGES=NULL
by judicious autoloading
-------------------------------------------------------------------------

That makes sense. But what about the change for R-trunk?

> 
> Now in R-trunk today, I see that there are no autloaded functions set up 
> from .First.sys() for any of the default packages. So if R is started 
> with R_DEFAULT_PACKAGES=NULL, then no default packages will be loaded 
> and no functions will be set up via autoload(). Why?
> 
> Jeff


-- 
http://biostat.mc.vanderbilt.edu/JeffreyHorner




More information about the R-devel mailing list