[R-pkg-devel] [patch] R CMD check when there are no .Rd examples

Neal Richardson neal.p.richardson at gmail.com
Wed May 10 17:28:17 CEST 2017

Last week I submitted a new package to CRAN, and it was rejected
because there were no examples in any of the man pages. That's a
reasonable requirement--I just didn't know it was one. When I looked
back at the R CMD check results locally, I saw

    * checking examples ... NONE

but the run still finished with

    Status: OK

so I believed that my package was good. The package did have usage
examples in the test suite and on the readme file, and it was no
problem to copy the examples over to a man page and resubmit. But it
seemed like an unfortunate and avoidable waste of the CRAN
maintainers' time to have to ask for revisions and review again.

I read the source and saw that the requirement around .Rd examples
that R CMD check does enforce is only when there are no examples, no
vignettes, and no tests
The attached one-line patch makes the check for .Rd examples now log a
"Note" rather than just print "NONE". Running it against my package
without man-page examples, it shows

    * checking examples ... NOTE
    No examples

and ends with

    Status: 1 NOTE

which should be enough to remind package authors to address it before
submitting to CRAN.

Thanks for considering this patch.


P.S. Since this is an issue about CRAN policy and package development,
I thought R-package-devel was the appropriate list to email, but
please let me know if I should send the patch to R-devel instead.
-------------- next part --------------
Index: src/library/tools/R/check.R
--- src/library/tools/R/check.R	(revision 72665)
+++ src/library/tools/R/check.R	(working copy)
@@ -2868,7 +2868,7 @@
                                  " check also with --run-donttest\n")
             } else {
-                resultLog(Log, "NONE")
+                noteLog(Log, "No examples")
                 no_examples <<- TRUE

More information about the R-package-devel mailing list