[R] Creating datasets
Duncan Murdoch
murdoch at stats.uwo.ca
Fri Jun 3 15:01:27 CEST 2005
On 6/3/2005 6:46 PM, Jim Lemon wrote:
> Hi folks,
>
> Having lost count of the times I have read the relevant section in
> R-exts.html (and by the way, where has that useful file gone? I had to
> look at it on CRAN.),
Should be in R_HOME/doc/manual.
searched for "creating datasets" (this is the
> first time that Jon Baron's excellent search site has let me down) and
> read the idiot's guide for creating packages, I am willing to admit that
> I have failed the test.
>
> First:
> Linux (Fedora Core 2)
> R-2.1.0
>
> I am attempting to integrate three functions that have been kindly
> donated to the plotrix package by Sander Oom dealing with plotting soil
> texture. Everything works okay, but I want to add a dataset to the
> package. R-exts says that three types of data files are okay:
>
> R code, rectangular tables (e.g. CSV) or files created by save (.rda)
>
> I note that all the "real" packages (oops, bundles) like MASS have three
> files in their data directory that look like an index of the datasets,
> the datasets themselves and something I haven't worked out yet. I
> haven't found a description of how to do that trick.
>
> Thus I created the dataset by reading a CSV data file into a data frame
>
> oksoil<-read.table("oksoil.csv",sep=",")
>
> That data frame works fine in all the functions. Then I saved it:
>
> save(oksoil,file="/home/jim/R/plotrix/data/oksoil.rda")
>
> But when I check the package, the examples don't work:
>
> R CMD check /home/jim/R/plotrix
> ...
> > data(oksoil)
> Warning in data(oksoil) : data set 'oksoil' not found
This looks like it should have worked. I don't know what went wrong for
you. Can you look in plotrix.Rcheck/plotrix/data and confirm that
oksoil.rda got installed there?
Duncan Murdoch
More information about the R-help
mailing list