[Rd] Query about .check_packages_used_in_examples
Berwin A Turlach
berwin at maths.uwa.edu.au
Mon Oct 11 00:06:46 CEST 2010
G'day all,
looking at
http://cran.at.r-project.org/web/checks/check_results_Sleuth2.html
I noticed that r-prerel-* and r-devel-* issue notes. Apparently, now
examples are more thoroughly checked by R CMD check and the note
pointed out that a package used in the examples was not declared. This
was easily fixed by adding 'Suggests: lattice' to the DESCRIPTION file
(now this change has to migrate through R-forge to CRAN).
But then I noticed that for another package I have on R-forge a similar
note is issued:
https://r-forge.r-project.org/R/?group_id=630&log=check_x86_64_linux&pkg=DeconWK&flavor=devel
O.k., R-forge is using R-devel, so I installed R 2.12.0 RC (2010-10-10
r53273) on my machine to check, same note is issued.
The note issued by R CMD check says:
* checking for unstated dependencies in examples ... NOTE
'library' or 'require' call not declared from: ks
which is a bit surprising.
There are three .Rd files that have a library(ks) in them and ks is
listed in the Imports: of the description file.
This seems to be completely in line with the documentation in "Writing
R extensions":
@item
Packages whose name space only is needed to load the package
using @code{library(@var{pkgname})} must be listed in the
@samp{Imports} field and not in the @samp{Depends} field.
that's why ks is listed in depends
@item
All packages that are needed to successfully run @code{R CMD
check} on the package must be listed in one of @samp{Depends}
or @samp{Suggests} or @samp{Imports}. [...]
which seems to be adhered to, since ks is in the depends.
But upon digging into .check_packages_used_in_examples in QC.R in
package tools, I have the impression that packages loaded in examples
via library() or require() are only checked against packages listed in
Suggests, Enhances and Depends, the package's own name and the standard
packages, but not against those listed in Imports. Thus, I believe
there is some disconnect between documentation and behaviour at the
moment.
In this particular case, possible solutions would be to list ks in
both, Imports and Suggests, or, to have only one entry, to move it to
Depends.
But I believe the cleaner solution would be that
.check_packages_used_in_examples includes the packages listed in
Imports when checking whether all packages used in library() or
require() commands in examples are declared.
Cheers,
Berwin
More information about the R-devel
mailing list