On 16 Nov 2013, at 03:06 , Charles Berry <ccbe...@ucsd.edu> wrote:

> Rolf Turner <r.turner <at> auckland.ac.nz> writes:
> 
>> 
>> 
>> I *do* see the same phenomenon that Bert describes and the code of 
>> predict.lm()
>> *does* appear to contain a bug.  There is a line:
>> 
> [snip]
> 
>> 
>> The operative difference between my set-up and Chuck's is that I am using
>> version 3.0.2 Patched.  So I am very puzzled as to why Chuck does *not* get
>> an error thrown!
>> 
> 
> [rest deleted]
> 
> The answer is that I made a rookie error.
> 
> I ran
> 
>  example(predict.lm)
> 
> before trying Bert's ECM.
> 
> And then I did not bother to see what example(predict.lm) left lying
> around in R_GlobalEnv ...
> 
> As you can probably guess, there was an object called 'w'.
> 
> So predict.lm finds it and is.null(w) is FALSE.
> 
> Mea culpa!

Hmm, maybe, but this is the sort of thing that code analysis tries to catch (as 
in "no visible binding for global variable 'w'"). Apparently, the code checker 
is not smart enough to detect cases where a local variable is _sometimes_ not 
defined.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd....@cbs.dk  Priv: pda...@gmail.com

______________________________________________
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