[R] Bug in predict.lm?

Charles Berry ccberry at ucsd.edu
Sat Nov 16 03:06:13 CET 2013

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:

> 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


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!

More information about the R-help mailing list