[Rd] Trying to understand the search path and namespaces

Hadley Wickham hadley at rice.edu
Tue Nov 16 02:45:30 CET 2010


> 1.6 of Writing R Extensions says
>
> Note that adding a name space to a package changes the search strategy.
> The package name space comes first in the search, then the imports, then
> the base name space and then the normal search path.
>
> I'm not sure of the details, but I think
>
>  parents(getNamespace("devtools"))

Ah, my mistake was assuming that the package namespace and environment
were the same thing.

Interestingly the namespace is dynamic:

> parents(getNamespace("devtools"))
...
[31] "base"
> library(roxygen)
> parents(getNamespace("devtools"))
...
[31] "Autoloads"            "base"

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



More information about the R-devel mailing list