R with R-devel gives global functional notes related to main package features

I am trying to prepare a package for release in CRAN. As part of the process - following Hadley’s recommendation for CRAN β€” I sent a win-builder package to test R with the development version of R, using:

 devtools::build_win(version = "R-devel")` 

In the audit log, I get the following note:

 * checking R code for possible problems ... NOTE [... specific notes, omitted for brevity] Undefined global functions or variables: as.formula coef complete.cases lines model.frame model.matrix model.response optim plogis plot pnorm predict printCoefmat quantile terms 

This note does not occur with:

  • OS X 10.10.3, R 3.2.1 on my local laptop
  • Ubuntu 12.04, R 3.1.2 via travis-ci
  • win-builder with R-release

The functions indicated in the note apply to packages included in the basic R installation, for example. stats , utils , graphics , and if I understand correctly that the note is due to the fact that I do not import specific functions / packages into my own NAMESPACE or DESCRIPTION package. I have included relevant sections from both files below.

1. Should I try to eliminate this note before sending it to CRAN?

I would do this by explicitly importing the base packages for the functions mentioned in the note, but given that the note does not occur with any of the other environments in which I tried to test R, it seems a bit redundant.

But it is also quite possible that I misunderstand what is happening here, therefore:

2. Why is this note found only with R-devel (on win-builder)?

Here are the relevant sections from my DESCRIPTION and NAMESPACE :

 Imports: corpcor, plyr, MASS, separationplot, stats, Rcpp (>= 0.11.0), xtable Suggests: testthat LinkingTo: Rcpp, RcppArmadillo 

NAMESPACE :

 importFrom(MASS,mvrnorm) importFrom(Rcpp,sourceCpp) importFrom(corpcor,make.positive.definite) importFrom(plyr,ddply) importFrom(separationplot,separationplot) importFrom(stats,AIC) importFrom(stats,BIC) importFrom(stats,logLik) importFrom(stats,nobs) importFrom(xtable,xtable) 
+6
source share
1 answer

This happens on R-devel because it is a relatively new change in CRAN policy.

The description of the change is here: http://developer.r-project.org/blosxom.cgi/R-devel/NEWS/2015/06/29#n2015-06-29

Some discussions on Twitter https://twitter.com/thosjleeper/status/615446807519305729

So yes, you need Imports: stats , utils and graphics , and then use the package:: notation when calling functions from these packages before sending them to CRAN.

+6
source

All Articles