[R-pkg-devel] Imports: vs Suggests:

Hugh Parsonage hugh.parsonage at gmail.com
Sat Jan 6 09:03:35 CET 2018


I write to clarify when a package should be in Imports: vs Suggests:.
Does the absence of warnings following a R CMD check --as-cran
guarantee that packages are placed in the correct field?

For example, consider a package with only one exported function:

isTrue <- function(x) hutils::AND(x, TRUE)

When I run R CMD check on this package with an otherwise valid
DESCRIPTION and NAMESPACE, I get a warning about an undeclared import.
That I understand.

But if I add

Suggests: hutils

to DESCRIPTION then R CMD check passes with no warnings. (hutils is
installed on my machine, so I don't receive a note about a package
being unavailable for checking.) My understanding is that because
isTrue won't run without hutils, the package must include hutils under
Imports (or Depends:) not Suggests: , but the R CMD check result gives
the impression that this decision is at the discretion of the package
author. In 'Writing R Extensions', there is a caveat that packages may
be in Suggests: rather than Imports if they are "loaded in the body of
functions", but I don't understand the distinction.

Furthermore, would it make a difference if instead of hutils being
used it was a base package (like stats) or a recommended package (like
KernSmooth)?


Hugh Parsonage
Grattan Institute



More information about the R-package-devel mailing list