[R] R package-building

Tim Hoar thoar at cgd.ucar.edu
Wed Jan 9 23:55:16 CET 2002


Hello,

I am building a package to read in a pretty common atmospheric data format
and create a SKEW-T, log p diagram (also very common for the atmospheric
community).

The problem is this: How should one address the (ASCII) data files so that
the examples find them? I have read through the "Writing R Extensions"
document and still have a problem.

There seems to be some sort of disconnect between getting the examples
to run when you "R CMD check <package>" and when you have them installed
and ready for general consumption.

Before the package is installed (i.e. during the "R CMD check") the
unix current working directory must be just below the package directory.

The package is going to be called RadioSonde (after the instrument that
collects the data), and I am building the package under unix.

   $cwd/RadioSonde/R/*.R     # including getsonde.R
   $cwd/RadioSonde/man/*.Rd
   $cwd/RadioSonde/data/ExampleSonde.txt

$cwd <prompt> R CMD check RadioSonde
[works fine, I can build]

In order to get the examples to "check" correctly they must be:

profile1 <- getsonde("RadioSonde/data/ExampleSonde.txt")

but then this is inappropriate for the installed version, which
really should key off the .path.package()  ...

> system("pwd")
/home/thoar
> .path.package("RadioSonde")
[1] "/contrib/R-1.3.0/lib/R/library/RadioSonde"
> ydata <- getsonde("RadioSonde/data/ExampleSonde.txt")
Error in file(file, "r") : cannot open file `RadioSonde/data/ExampleSonde.txt'


Any hints?



## Tim Hoar, Associate Scientist              email: thoar at ucar.edu     ##
## Geophysical Statistics Project             phone: 303-497-1708       ##
## National Center for Atmospheric Research   FAX  : 303-497-1333       ##
## Boulder, CO  80307                    http://www.cgd.ucar.edu/~thoar ##

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