G'day Hadley,
On Mon, 15 Nov 2010 19:45:30 -0600
Hadley Wickham had...@rice.edu wrote:
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
Ah, my mistake was assuming that the package namespace and environment
were the same thing.
Interestingly the namespace is dynamic:
Not sure what you mean with this. Section 1.6 of Writing R
Extensions explicitly states:
Name spaces are @emph{sealed} once they are loaded. Sealing
G'day Hadley,
On Tue, 16 Nov 2010 07:35:09 -0600
Hadley Wickham had...@rice.edu wrote:
Well, as the part of Writing R Extensions that Martin quoted
states, the normal search path is part of the search path used by
packages with name spaces. So if you attach another package via
Hi all,
I'm trying to understand how the search path and namespaces interact.
For example, take the devtools package which suggests the testthat
package. Here's what the search path looks like after I load each of
those packages:
library(devtools)
search()
[1] .GlobalEnv
On Mon, Nov 15, 2010 at 3:26 PM, Hadley Wickham had...@rice.edu wrote:
Hi all,
I'm trying to understand how the search path and namespaces interact.
For example, take the devtools package which suggests the testthat
package. Here's what the search path looks like after I load each of
those
With a small risk of being incorrect (and the chance of learning
something new), I'll give it a try:
A search for a functions/objects/... that is not in the same package
environment is done in the order that the search() path gives. The
exception to this iff your package has a namespace,
Well, that's what I thought too. But:
parents - function(x) {
if (identical(x, emptyenv())) return()
c(environmentName(x), parents(parent.env(x)))
}
parents(as.environment(package:devtools))
[1] package:devtools package:methods Autoloads base
And package:testthat isn't listed
On 11/15/2010 04:56 PM, Hadley Wickham wrote:
Well, that's what I thought too. But:
parents - function(x) {
if (identical(x, emptyenv())) return()
c(environmentName(x), parents(parent.env(x)))
}
parents(as.environment(package:devtools))
[1] package:devtools package:methods Autoloads
Hadley Wickham wrote:
Hi all,
I'm trying to understand how the search path and namespaces interact.
For example, take the devtools package which suggests the testthat
package. Here's what the search path looks like after I load each of
those packages:
Luke Tierney wrote up a nice description
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
Hi Duncan: Luke's article is in the June, 2003 edition of R-news
On Mon, Nov 15, 2010 at 8:43 PM, Duncan Murdoch murdoch.dun...@gmail.comwrote:
Hadley Wickham wrote:
Hi all,
I'm trying to understand how the search path and namespaces interact.
For example, take the devtools package which
11 matches
Mail list logo