Skip to content
Prev 29448 / 63424 Next

Checking package help file examples

On Friday 18 July 2008 02:19:14, Bill Dunlap wrote:
I use *.R and corresponding *.Rout.save files in the subdirectory "tests" for 
checking packages (see e.g., packages systemfit, micEcon, 
sampleSelection, ...). I think that it is better to separate examples from 
testing, because IMHO there should be a few simple examples but tests should 
contain many different function calls with (partly) unusual arguments to 
check (nearly) the entire functionality of each function.

See also the manual "Writing R Extensions"
http://cran.r-project.org/doc/manuals/R-exts.html#Package-subdirectories
======================================
Subdirectory tests is for additional package-specific test code, similar to 
the specific tests that come with the R distribution. Test code can either be 
provided directly in a .R file, or via a .Rin file containing code which in 
turn creates the corresponding .R file (e.g., by collecting all function 
objects in the package and then calling them with the strangest arguments). 
The results of running a .R file are written to a .Rout file. If there is a 
corresponding .Rout.save file, these two are compared, with differences being 
reported but not causing an error. The directory tests is copied to the check 
area, and the tests are run with the copy as the working directory and with 
R_LIBS set to ensure that the copy of the package installed during testing 
will be found by library(pkg_name). 
======================================

Best wishes,
Arne