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

From: Spencer Graves <>
Date: Mon, 11 Apr 2011 11:53:33 -0700

Another example:

plot.landsurveydata: no visible binding for global variable 'value' plot.landsurveydata: no visible binding for global variable 'variable'

plot.landsurveydata <- function(...){
# ...
qplot(time., value, data=X, color=variable, ...) # where value and variable are columns of the data.frame X

       Is there a way to tell "R CMD check" that qplot looks for time., value and variable as columns of X?


On 4/11/2011 9:04 AM, Spencer Graves wrote:

> On 4/11/2011 8:46 AM, Simon Urbanek wrote:

>> On Apr 11, 2011, at 11:28 AM, Davor Cubranic wrote:
>>> On 2011-04-09, at 2:08 PM, Ted Harding wrote:
>>>> I think the right thing to so is to introduce the students to the
>>>> basics of scoping, early in the process of learning R.
>>> I know the basics of scoping perfectly well, but that doesn't stop
>>> me from occasionally misspelling a variable name that only causes an
>>> error much later.
>>> OTOH, I think with Perl you can start declaring your variables
>>> "local" and keep the interpreter happy. But in R's context you then
>>> have to also start declaring what you expect to inherit from parent
>>> environments, and pretty soon the code is so encrusted with
>>> annotation barnacles that it loses the simplicity that makes R so
>>> nice in the interactive mode.
>>> What would be really nice is if we had a smart R editor/IDE that
>>> would "DWIM" and put a red underline under a misspelled name, but
>>> leave it alone when, as Duncan said, it's in the environment.
>> ... which is, of course, impossible since the editor has no idea what
>> environment you will evaluate the function in ... It can make
>> assumptions but they may as wrong as the spurious warnings discussed
>> so people will complain either way ;)
>       For the record, my "complaint" stemmed from my inability to see 
> a way to get rid of that message in that context.  In most cases, I've 
> found that message to be very valuable in identifying latent bugs in 
> code.  In that context, however, the message seemed inappropriate.  
> Duncan privately suggested I add "LazyData:  yes" to the package 
> DESCRIPTION file.  I did that, and the offending message disappeared!
>       Thanks again to Duncan.
>       Best Wishes,
>       Spencer

>> Cheers,
>> Simon
>> ______________________________________________
>> mailing list
Spencer Graves, PE, PhD
President and Chief Operating Officer
Structure Inspection and Monitoring, Inc.
751 Emerson Ct.
San Josť, CA 95126
ph:  408-655-4567

______________________________________________ mailing list
Received on Mon 11 Apr 2011 - 18:56:21 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 Mon 11 Apr 2011 - 20:40:44 GMT.

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

list of date sections of archive