I am trying to prepare a package for release to CRAN. As part of the process--following Hadley's advice on releasing to CRAN--I have submitted the package to win-builder
for R check with the development version of R using:
devtools::build_win(version = "R-devel")`
I get the following note in the check log:
* 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:
The functions referenced in the note are from packages included with the base R installation, e.g. stats
, utils
, graphics
, and if I understand correctly the note occurs because I do not explicitly import the specific functions/packages in my own package NAMESPACE
or DESCRIPTION
files. I've included the relevant sections from both files below.
1. Should I try to address this note before attempting to release to CRAN?
I'd probably do this by explicitly importing the base packages for the functions referenced in the note, but given that the note doesn't happen with any of the other environments in which I tried R check, it seems a bit redundant.
But it's also entirely possible that I misunderstand what is going on here, hence:
2. Why is this note only occurring with R-devel (on win-builder)?
Here are the relevant sections from my DESCRIPTION
and NAMESPACE
files:
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)
This occurs on R-devel because it's a relatively new change to the CRAN policy.
A description of the change is here: http://developer.r-project.org/blosxom.cgi/R-devel/NEWS/2015/06/29#n2015-06-29
Some discussion on Twitter https://twitter.com/thosjleeper/status/615446807519305729
So, yes, you should Imports:
stats
, utils
, and graphics
and then use the package::
notation when calling functions from those packages before you submit to CRAN.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With