Reputation: 21719
I am working on my R package. I am getting this error:
Namespaces in Imports field not imported from:
‘kableExtra’ ‘ranger’
All declared Imports should be used.
I get this error with devtools::check_rhub()
i.e. on linux and windows platform. When I check my package locally (mac os) with devtools::check()
all checks gets passed successfully.
I looked deeper into the imports of my description file, currently I am doing:
Imports:
ranger(>= 0.10.1),
Metrics(>= 0.1.3),
kableExtra(>= 0.9.0)
I am using functions from ranger
and kableExtra
using ::
like ranger::function_name
, kableExtra::function_name
since there are just one or two functions I need.
I am not doing importFrom
in Namespace file. Because, like I said, there are just 1 or 2 functions I need to borrow.
Why am I getting this error ? What am I missing ?
Upvotes: 8
Views: 3398
Reputation: 497
When the error is related to the package Rdpack
Namespace in Imports field not imported from: 'Rdpack'
it is more subtle as we do not use directly this package (it is used internally during devtools::check()
. The Rdpack documentation indicates that this line:
# ' @importFrom Rdpack reprompt
must be added anywhere in your documentation (if you are using roxygen2) or this line in NAMESPACE
importFrom(Rdpack,reprompt)
if you maintain NAMESPACE manually
Upvotes: 1
Reputation: 21719
I fixed the problem with this workaround:
Namespace
file with importFrom
.::
, if the package name is mentioned in the Imports
or Depends
, it will raise an error. Upvotes: 7