[Rd] Re: [R] Getting data loaded

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Aug 19 08:53:34 CEST 2004


Diverted to R-devel: please see the posting guide.

On Wed, 18 Aug 2004, Roger D. Peng wrote:

> I think you should load data in a .First.lib() function, or if 
> you have a namespace, in a .onLoad() function.

Yes, indeed.  However, using data() for system data is not a good idea and 
for R 2.0.0 you can use the new sysdata.rda facility (documented in R-exts 
for that version-to-be).

The issue is that the code in install.R is run *before* the saved image in
the package is loaded (even though it is run after the package itself is
sourced), so you needed data(Wcrit01, package="concord").  When you put
these in a .First.lib you should still specify the package for safety.

Finally, see the (currently draft) file

http://developer.r-project.org/200update.txt


> Jim Lemon wrote:
> > Hi,
> > 
> > I have been informed of a bug in the concord package, in that the data files 
> > containing the tabulated critical values for Kendall's W are not loaded on 
> > the command library(concord).
> > 
> > I had assumed that the lines in install.R would correspond to the commands to 
> > load data in R, e.g.
> > 
> > data(Wcrit01)
> > data(Wcrit05)
> > 
> > While these work on the command line, 

Don't think so.  You need to load your package first.

> I get the errors:
> > 
> > library(concord)
> > Warning messages:
> > 1: Data set 'Wcrit01' not found in: data(Wcrit01)
> > 2: Data set 'Wcrit05' not found in: data(Wcrit05)
> > 
> > The section on this in R-exts doesn't seem to have any information on how to 
> > write the lines in install.R, nor does Checking and Building Packages. I 
> > managed to locate a few install.R files in other packages, but they were all 
> > empty. Any hints?

Don't use install.R.

> > Jim
> > 
> > Dr Jim Lemon
> > Research Psychologist
> > Health Psychology Unit
> > University of Technology, Sydney
> > 
> > Feel free to ignore any garbage beneath this line.
> >
> 
> ______________________________________________
> 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
> 
> 

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list