data in R packages (was [R] Writing R Library)

Prof Brian D Ripley ripley at stats.ox.ac.uk
Sat Aug 25 12:39:11 CEST 2001


On Sat, 25 Aug 2001, Ko-Kang Kevin Wang wrote:

> I'm trying to write an R library (for Windows version) when I encountered
> this problem.

I guess you mean a package: a library is a directory containing installed
packages.

> I put in a dataset called mussels into a sub-folder, data (I saw this is
> how it is done in other libraries).  However when I load the library in R
> and typed:
>   data(mussels)
> it complains it cannot find the data set in the library.
>
> Everything else works fine (so far), am I missing something here?

You need to follow the instructions in `Writing R Extensions'.

  The @file{data} subdirectory is for additional data files the package
  makes available for loading using @code{data()}.  Currently, data files
  can have one of three types as indicated by their extension: plain R
  code (@file{.R} or @file{.r}), tables (@file{.tab}, @file{.txt}, or
  @file{.csv}), or @code{save()} images (@file{.RData} or @file{.rda}).

Note, `by their extension'.

When all else fails, read the manual ....

-- 
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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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