Re: [Rd] Wish there were a "strict mode" for R interpreter. What about You?

From: <>
Date: Sun, 10 Apr 2011 12:54:38 -0500

On Sun, 10 Apr 2011, Hadley Wickham wrote:

>>> Okay, I understand what you are trying to do.  Yes, you have fooled codetools in this instance.
>> ...but notice that the codetools warning is just that: It _is_ acknowledged that these things occasionally happen by design. There are a couple of cases in base R too:
>> * checking R code for possible problems ... NOTE
>> no visible binding for global variable ‘n’
> Are you sure that's not a bug? There's:
> aic.model <- aic(y, n, mu, weights, dev) + 2 * rank
> and n.ok is defined, but n isn't defined anywhere.

It is (or should be) defined by the call to


>> quantile.ecdf: no visible binding for global variable ‘y’
> I wonder why it warns on y, but not nobs.

It does when run on stats:::quantile.ecdf directly:

> codetools::checkUsage(stats:::quantile.ecdf)
<anonymous>: no visible binding for global variable ‘nobs’ <anonymous>: no visible binding for global variable ‘y’

Maybe in the context where you saw this nobs is defined in an enclosing environment.


> Hadley

Luke Tierney
Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:
Iowa City, IA 52242                 WWW:

______________________________________________ mailing list

Received on Sun 10 Apr 2011 - 17:59:24 GMT

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 Sun 10 Apr 2011 - 18:30:42 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive