I have a package that contains the following package Imports in the DESCRIPTION file:
Imports: lubridate,
assertthat,
R6,
stringr
I don't import these into my package's NAMESPACE using an import(pkgname)
or importFrom(pkgname, fn)
commands. Rather I refer to these package's functions in my R code using a fully qualified call. Based on my reading of R-ext, this is permissible:
The ‘Imports’ field lists packages whose namespaces are imported from (as specified in the NAMESPACE file) but which do not need to be attached. Namespaces accessed by the ‘::’ and ‘:::’ operators must be listed here...
However, I get the following error when I run devtools::check()
:
* checking dependencies in R code ... NOTE
Namespaces in Imports field not imported from:
'R6' 'stringr'
All declared Imports should be used.
See the information on DESCRIPTION files in the chapter 'Creating R
packages' of the 'Writing R Extensions' manual.
NB: to confirm, my R code contains fully qualified calls to functions in R6 and stringr (e.g. stringr::str_detect(...)
and R6::R6Class(...)
).
Why am I getting these notes? And how do I make them go away?
importFrom
will remove the note, please try that. – tonytonov::
– imanuelcostigan