From jmc at r-project.org  Sat Apr 28 02:02:37 2012
From: jmc at r-project.org (John Chambers)
Date: Fri, 27 Apr 2012 17:02:37 -0700
Subject: [Rd] globalVariables()
Message-ID: <4F9B339D.8070907@r-project.org>

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 
valid notes.

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.)

John



[Rd] globalVariables()
John Chambers