[R] Packages: What expressions are allowed outside/before .First.lib?
Thomas Lumley
tlumley at u.washington.edu
Thu Aug 9 19:13:20 CEST 2001
On Tue, 7 Aug 2001, Henrik Bengtsson wrote:
> Follow up on my own message: I found autoload(), see under Q4 below:
>
> >
> > Q4. What I really want to do is to declare "modifiers<-" in
> > another package,
> > lets call it, 'myrootlib', which all other libraries we write relies on.
> > Trying
> >
> > require(myrootlib) # Declares "modifiers<-"
> >
> > callMe0 <- function(x)
> > cat("hey\n")
> > modifiers(callMe0) <- c("private")
> >
> > callMe <- function(x)
> > callMe0(x)
> > modifiers(callMe) <- c("public")
> >
> > won't work! The reason for this seems to be that the package
> > 'myrootlib' is
> > not loaded (evaluated) until afterwards. This brings up the
> > issues asked in
> > Q1 and Q2. Is there another way to do it or do we have to go back to the
> > approaches explained in Q3, Q2 or even Q1?
> >
>
> Instead of 'require(myrootlib)' above, it looks like
> 'autoload("modifiers<-", "myrootlib")' would work. Is this a correct way to
> use autoload?
>
Well, it's valid.
The current autoload() is really a proof-of-concept and might well get replaced or removed by a more elegant mechanism at some point. My guess is that the order in which the files are concatenated may actually be more reliable than autoload.
-thomas
Thomas Lumley Asst. Professor, Biostatistics
tlumley at u.washington.edu University of Washington, Seattle
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list