On Tue, 2 Sep 2008 [EMAIL PROTECTED] wrote:

The statement Globals <<- list() in the body of a function in a package was
intended to write an empty list to the R workspace to collect results during the computations of the function. A package name space has not beenspecified.

The package appears to function correctly, but

during the R CMD check of the package while "checking R code for possible
problems ... NOTE",

no visible binding for '<<-' assignment to 'Globals' is displayed.

Can you tell in this case why the binding needs to be visible?  What
statement might do that?  A specific reference in the R manuals would be
appreciated.

The message really parses as "no binding (as far as we can see)" - it's a 
request for a binding, not a request for visibility. It's phrased that way because it is 
possible to have false positives in this code -- variables that really have been 
previously defined, but don't look as if they have.

You are using <<- on a variable that doesn't appear to have been previously 
defined in your code.  In fact, as you tell us, it wasn't previously defined, so the 
note is correct.  This isn't an error, but is often a bad idea: the assignment will 
overwrite any existing variable called Globals that happens to be in the workspace.

One alternative (since you don't have a namespace) would be to define a variable
  Globals <- list()
at the top level in your package.  The superassignments would then modify that 
variable.

       -thomas



Thomas Lumley                   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]       University of Washington, Seattle

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to