Joshua Rosenberg
Joshua Rosenberg

Reputation: 4226

R CMD check NOTE: Namespace in Imports field not imported

I continue to get the following R CMD check (via devtools::check()) for a package I am preparing to submit to CRAN (you can see the results for the package here:

Check: dependencies in R code 
Result: NOTE 
    Namespace in Imports field not imported from: ‘tidyr’
     All declared Imports should be used. 

The source code for the package is here on GitHub. I've removed any mention of tidyr or its functions throughout the package, but the note remains. There are a number of Stack Overflow questions (i.e., this and other resources on this, but none seem to apply to this situation. How can I address this note?

Upvotes: 19

Views: 5092

Answers (1)

josep maria porrà
josep maria porrà

Reputation: 1388

This message appears when you include a package in the Imports: field in DESCRIPTION file and no function in this namespace is called by any function of the package. In this case, it means that in the R code of the package there was no call like tydir::fun, where fun represents any function of that package.

To solve it, simply delete the reference to the package in Imports: field within DESCRIPTION file. This was fixed in this commit for the package involved in the question: clustRcompaR.

If you don't want the message to appear when you check the package using devtools:check(), set option CRAN = FALSE: devtools::check(CRAN = FALSE)

Upvotes: 5

Related Questions