Namespaces in Imports field not imported from: All declared Imports should be used

Viewed 1273

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 ?

1 Answers

I fixed the problem with this workaround:

  1. Add the name of the package in Namespace file with importFrom.
  2. Doesn't matter if you are borrowing just one function from a package using ::, if the package name is mentioned in the Imports or Depends, it will raise an error.
Related