[Rd] globalVariables()

From: John Chambers <jmc_at_r-project.org>
Date: Fri, 27 Apr 2012 17:02:37 -0700

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


R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sat 28 Apr 2012 - 00:06:11 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 28 Apr 2012 - 00:10:52 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive