[R] keep.source.pkgs()
Thomas Lumley
tlumley at u.washington.edu
Wed Aug 4 00:59:04 CEST 2004
On Tue, 3 Aug 2004, Rolf Turner wrote:
>
> Thomas Lumley wrote:
>
> > Because, as you noted, the base packages are stored in binary form. This
> > already speeds things up, and will have even more impact in 2.0.0 with
> > "lazy loading" of functions.
>
> This CANNOT be the (complete) explanation, because the utils
> package behaves differently from the stats package.
>
> What I mean is, your explanation explains why you never
> get the source attributes ***at all*** with the stats
> package.
>
> It doesn't seem to me to explain why setting
> keep.source.pkgs=TRUE, detaching and reloading doesn't work
> for utils, whereas effectively setting keep.source.pkgs=TRUE
> ``a priori'' and then loading utils ***does*** work.
>
> And ***nothing*** works with the stats package. Moreover in
> .../library/utils/R you find the ascii source file ``utils''
> and ***NOT*** a binary ``all.rda'' file.
That is why something works for utils and nothing works for stats.
I can't remember the historical reason why utils isn't loaded in binary
form in 1.9.1. In r-devel they are all loaded from binary databases when
used.
The reason why detach and reload doesn't work but restarting does work for
utils is that detach() does not unload the package, it only detaches it.
This distinction was introduced with namespaces. A package can be loaded
but not in the search path.
For example
> detach(utils)
> help(detach)
Error: couldn't find function "help"
but
> utils::help(detach)
still works, showing that the package is loaded but not attached. If you
try to unload it
> unloadNamespace("utils")
Error in unloadNamespace("utils") : name space still used by: stats,
methods
you can't.
-thomas
Thomas Lumley Assoc. Professor, Biostatistics
tlumley at u.washington.edu University of Washington, Seattle
More information about the R-help
mailing list