Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R check with R-devel gives global function notes related to core package functions

Tags:

r

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:

  • 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 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)
like image 747
andybega Avatar asked Jul 09 '15 08:07

andybega


1 Answers

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.

like image 164
Benjamin Avatar answered Oct 25 '22 03:10

Benjamin