Skip to content
Prev 23149 / 63421 Next

Enhances, require() and quality control

Hello!

I am working on a package where Enhances field seems to be a plausible
option. When I add package, say coda, to this field, I get the following
warning with recent R-devel:

----

* checking for working latex ... OK
* using log directory '/home/ggorjan/programs/R/devel/test.Rcheck'
* using R version 2.5.0 Under development (unstable) (2006-12-06 r40129)
* checking for file 'test/DESCRIPTION' ... OK
* this is package 'test' version '0.1'
* checking package dependencies ... WARNING
'library' or 'require' calls not declared from:
  coda

See the information on DESCRIPTION files in the chapter 'Creating R
packages' of the 'Writing R Extensions' manual.

----

I have require(code) somewhere in the code. Is this OK or is R CMD check
to stringent in case of enhances field - I get no warning if that
package is in depends or suggests fields?

After a short look into src/library/tools/R/QC.R I think that the
following might be the solution. I did not do any other testing than
with my package, where R CMD check (R with proposed change) passed
without warnings.

Index: src/library/tools/R/QC.R
===================================================================
--- src/library/tools/R/QC.R    (revision 40129)
+++ src/library/tools/R/QC.R    (working copy)
@@ -3659,8 +3659,8 @@
     standard_package_names <-
         .get_standard_package_names()$base %w/o% c("methods", "stats4")
     depends_suggests <- c(depends, suggests, pkg_name, contains,
-                          standard_package_names)
-    imports <- c(imports, depends_suggests, enhances)
+                          standard_package_names, enhances)
+    imports <- c(imports, depends_suggests)
     ## the first argument could be named, or could be a variable name.
     ## we just have a stop list here.
     common_names <- c("pkg", "pkgName", "package", "pos")