[R] Lazy loading... advices

Philippe Grosjean phgrosjean at sciviews.org
Sun Oct 17 10:58:04 CEST 2004

Dear Douglas, Uwe and Martin,

Thank you for your prompt reply,... And thank you for reminding me that
library <> package. When I learned R, I was thinking library = package, as
well as workspace = environment... And now it appears this is deep in my
memory, despite I read several times the explanation on the difference!

I have read that R-news article, but too fast, certainly. First, I probably
need to use "Imports" somewhere, and second, I am most certainly in the same
case as Rcmdr, thus I must try "LazyLoad: no". Also, I don't use a
"NAMESPACE" yet (all the functions must be visible, except one, so a little
gain). But, may be, I should try with its "Import()" entry?

Regarding the long "Depends", the reason is that the GUI API adds a layer on
top of many other functions. This is rather unusual. I check this, and it
happens to be correct.



> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Martin Maechler
> Sent: Saturday, October 16, 2004 9:17 PM
> To: Uwe Ligges
> Cc: r-help at stat.math.ethz.ch; Philippe Grosjean
> Subject: Re: [R] Lazy loading... advices
> >>>>> "UweL" == Uwe Ligges <ligges at statistik.uni-dortmund.de>
> >>>>>     on Sat, 16 Oct 2004 18:31:29 +0200 writes:
>     UweL> Philippe Grosjean wrote:
>     >> Hello,
>     >> 
>     >> I am looking for more information about lazy loading
>     >> introduced in R 2.0.0.  Doing ?lazyLoad I got some and
>     >> there is a 'see also' section that points to
>     >> 'makeLazyLoading'... But I cannot reach this page.
>     >> 
>     >> My problem is: I recompiled a library
>     UweL> Philippe,
>     UweL> citing Doug Bates: "Someone named Martin Maechler will
>     UweL> shortly be sending you email regarding the distinction
>     UweL> between 'library' and 'package'". ;-)
> of course, now I have to .... 
> Note that library(<package>) attaches and loads a *package* 
> from one of possibly several libraries { = the directories 
> listed, e.g., by .libPaths() !} 
>     >> that uses a lot of functions from other libraries (of
>     >> course I can give details if needed). I load it in my
>     >> computer: library(svGUI), and it takes something like 20
>     >> seconds to load. In R 1.9.1 it took 3-4 seconds on the
>     >> same machine (Windows XP). So, I try now to understand
>     >> the mechanism and to find a way to lower the loading time
>     >> of this library with lazy loading (its goal is to load
>     >> faster, isn't, so I probably do something wrong).
>     UweL> It might not always be faster. See Brian Ripley's
>     UweL> article in the most recent R Newsletter. Probably you
>     UweL> are using a lot of functions in the startup directly
>     UweL> after the call to library() (in .First.lib() or
>     UweL> .onLoad() or Hooks or whatever).  I think you want to
>     UweL> specify "LazyLoad: no" in the package's DESCRIPTION
>     UweL> file (cp. "Writing R Extensions").
> I'm pretty sure the increased startup time comes from the 
> very long 'Depends:' field in Philippe's package.
> I'd bet that -- after reading Brian's article -- Philippe 
> will find that he can make the 'Depends' much smaller, e.g., 
> by moving entries to 'Suggests'.
> Martin
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html

More information about the R-help mailing list