[R] How packages are set up

Luke Tierney luke at nokomis.stat.umn.edu
Tue May 1 22:26:45 CEST 2001

On Tue, May 01, 2001 at 09:38:01AM -0700, Thomas Lumley wrote:
> On Tue, 1 May 2001, Frank E Harrell Jr wrote:
> > In trying to get more familiar with R I have two questions.
> >
> > 1. For large packages it would be slow to parse all R source
> > code for the package each time library() is issued.
> > Yet I haven't found where a package's functions are stored
> > in in .RData format.  Would someone please clarify this?
> Well, the R source code *is* all parsed each time library() is issued, and
> it isn't that slow. On my system (with network drives) it is less than a
> second even for nlme, survival5, and MASS.  I don't think .RData format
> would be that much faster.  The time to load the ratetables dataset in
> survival5 (which is in .RData format) and to load the nlme package are
> similar, and they are about the same size.

Just to follow up on the use of .RData format to store package code:
unfortunately this is currently only worth while if a significant
amount of computation can be moved from load time to package creation
time.  If this is not the case, .RData currently loses both on speed
and size: On my system loading nlme with library takes about 1.5
seconds; loading a version saved as .RData takes over 3 seconds.  The
R/nlme file in the installed package is also quite a bit smaller than
the .Rdata version.

This is clearly something we need to work on, and both loading speed
and size of .RData files used for code are likely to improve over
time.  Performance for data already seems to be quite reasonable.


Luke Tierney
University of Minnesota                      Phone:           612-625-7843
School of Statistics                         Fax:             612-624-8868
313 Ford Hall, 224 Church St. S.E.           email:      luke at stat.umn.edu
Minneapolis, MN 55455 USA                    WWW:  http://www.stat.umn.edu
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