Skip to content
Prev 48892 / 63424 Next

no visible binding for global variable for data sets in a package

I'm updating the Lahman package of baseball statistics to the 2013 
release. In addition to
the main data sets, the package also contains several convenience 
functions that make use
of these data sets.  These now trigger the notes below from R CMD check 
run with
Win builder, R-devel.  How can I avoid these?

* using R Under development (unstable) (2014-08-25 r66471)
* using platform: x86_64-w64-mingw32 (64-bit)
   ...
* checking R code for possible problems ... NOTE
Label: no visible binding for global variable 'battingLabels'
Label: no visible binding for global variable 'pitchingLabels'
Label: no visible binding for global variable 'fieldingLabels'
battingStats: no visible binding for global variable 'Batting'
battingStats: no visible global function definition for 'mutate'
playerInfo: no visible binding for global variable 'Master'
teamInfo: no visible binding for global variable 'Teams'

One such function:

## function for accessing variable labels

Label <- function(var, labels=rbind(battingLabels, pitchingLabels, 
fieldingLabels)) {
     wanted <- which(labels[,1]==var)
     if (length(wanted)) labels[wanted[1],2] else var
}