jmc at r-project.org
Sat Apr 28 02:02:37 CEST 2012
There have been several threads on this list about the Notes generated
in the check process regarding "global variables" with no visible
definition. These can be useful but false positives tend to obscure
The function globalVariables() has been added to the utils package, in
the development version and in 2.15.0 patched (as of revision 59233).
Calls to it declare variables that should be regarded as defined when a
package's R code is checked, even if codetools does not find a
corresponding global assignment. The resulting vector of names from the
package is passed to codetools by the checking code.
Package authors should insert calls into the package's source,
preferably near where they do something sensible that defines the
objects in question. See ?globalVariables.
(One instance of the problem is that fields and methods used in
reference class methods were considered undefined. A corresponding
revision to setRefClass() and partners declares fields and methods to
globalVariables(). Packages do not need to call globalVariables()
explicitly for fields and methods, and should not.)
More information about the R-devel