Alex Rossell Hayes
Alex Rossell Hayes

Reputation: 61

Unexpected NOTE: Namespace in Imports field not imported from: ‘R6’

My (admittedly silly) package twenty48 is implemented using an R6 class. However, I get an unexpected R-CMD-check NOTE in several flavors on CRAN:

Namespace in Imports field not imported from: ‘R6’

I don't get this NOTE on my own Windows machine or on any of my GitHub actions instances.

I'm wondering if this occurs because I don't call R6 from within any of my functions. The only call to R6 is in a separate file that constructs the R6 class.

Does R6 not need to be imported if it isn't called from within a function? Or should I change the structure of my package even though it functions correctly (e.g. place the constructor inside a function like .onLoad() or add an importFrom() to my NAMESPACE)?

Upvotes: 1

Views: 481

Answers (1)

polkas
polkas

Reputation: 4184

This is a global problem on CRAN as additional check is added - Examples:

https://cran.r-project.org/web/checks/check_results_cat2cat.html

https://cran.r-project.org/web/checks/check_results_ggplot2.html

You have to add sth like that to .R file - Check if NAMESPACE file is updated:

#' @import R6
NULL

to find out this NOTEs and check if everything is working correctly use rcmdcheck in rcmdcheck package.

rcmdcheck::rcmdcheck()

Upvotes: 2

Related Questions