[Rd] Checking package help file examples

Bill Dunlap bill at insightful.com
Fri Jul 18 02:19:14 CEST 2008

I am trying to figure out the sanctioned way for
'R CMD check pkg' to make sure that the examples
in help files give the expected results.

Writing R Extensions says that check runs the help
file examples (which INSTALL extracts from pkg/man/*.Rd
and puts into files in pkg/R-ex).  It looks like check
concatenates all the example files, pkg/R-ex/*.R, into one
file, pkg/pkg-Ex.R, which it runs to produce pkg/pkg-Ex.Rout.
If there is an error running these files then check aborts.

I don't seen anything in Writing R Extensions about
checking that correct results were produced.  However,
in R 2.7.0, check will compare pkg/pkg-Ex.Rout to
pkg/tests/Examples/pkg/pkg-Ex.Rout.save, if the latter
file is in your package source, and report any differences.

I don't see any mention of this and was wondering if this
method should be recommended or if there was a preferred
way to check help file examples for correctness.  (It would
be nicer if the example() function could also check for
correctness, and the above method doesn't allow for that.)

Bill Dunlap
Insightful Corporation
bill at insightful dot com

 "All statements in this message represent the opinions of the author and do
 not necessarily reflect Insightful Corporation policy or position."

More information about the R-devel mailing list