[R-pkg-devel] Dependencies NOTE lost with --as-cran

Jeffrey Dick j3||d|ck @end|ng |rom gm@||@com
Fri May 22 16:14:20 CEST 2020


Hi all,

I'm not sure whether this is a packaging problem or a bug. Consider a
minimal package 'testpkg' with these files. The DESCRIPTION is
slightly modified from the output of utils::package.skeleton() to
create valid Title, Description, and License, and add a single package
to Imports.

---

DESCRIPTION
-----------
Package: testpkg
Type: Package
Title: What the Package Does (Short Line)
Version: 1.0
Date: 2020-05-22
Author: Who wrote it
Maintainer: Who to complain to <yourfault using somewhere.net>
Description: More about what it does (maybe more than one line).
License: GPL-2
Imports: MASS

NAMESPACE [empty file]
---------

R/testfun.R
-----------
testfun <- function() {}

---

Note that NAMESPACE is present, but empty, so that testfun() is not
exported, and R CMD check doesn't complain about missing
documentation.

After building the package using R CMD build testpkg, I checked it twice with
R Under development (unstable) (2020-05-19 r78492) -- "Unsuffered Consequences"

1) R CMD check testpkg_1.0.tar.gz
...
* checking dependencies in R code ... NOTE
Namespace in Imports field not imported from: ‘MASS’
  All declared Imports should be used.
...

2) R CMD check --as-cran testpkg_1.0.tar.gz
...
* checking CRAN incoming feasibility ... NOTE
[omitted text about New submission and placeholder content]
...
* checking dependencies in R code ... OK
...

My question is why the NOTE for "checking dependencies in R code" is
not present when using --as-cran? Possible clue: the NOTE also
disappears if testfun.R is removed.

Context: My package canprot_1.0.0 was recently published on CRAN. My
local checks with R CMD check --as-cran and checks on winbuilder both
showed "checking dependencies in R code ... OK", but now that the
package is on CRAN, a NOTE about "Namespace in Imports field not
imported from: ‘knitr’" appears for a subset of check flavors
(https://cran.r-project.org/web/checks/check_results_canprot.html).

I found a probable solution for canprot, which is to move knitr from
Imports to Suggests. However, I am surprised that the package
apparently needs to be checked *without* --as-cran to raise this NOTE.

This unanswered SO question seems related (specifically, the
'unfortunate note' comment of @vlad1490), but doesn't addresses the
particular behavior of --as-cran:
https://stackoverflow.com/questions/48487541/r-cmd-check-note-namespace-in-imports-field-not-imported

Cheers,

Jeff



More information about the R-package-devel mailing list