[R] Creating datasets

From: Jim Lemon <bitwrit_at_ozemail.com.au>
Date: Sat 04 Jun 2005 - 08:46:37 EST


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.), 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
> # first just show the soil triangle
> soil.texture()
> # now plot the observations
> show.soil.texture(oksoil)

Error in show.soil.texture(oksoil) : Object "oksoil" not found Execution halted

I promise to try writing an "Idiot's Guide to Creating Datasets" if someone can provide a method.

Jim



R-help@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 Received on Fri Jun 03 22:50:10 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:22 EST