Re: [Rd] variable scope in update(): bug or feature?

From: Martin Maechler <>
Date: Fri 22 Dec 2006 - 08:17:21 GMT

Hi Michael,
can you please

>>>>> "Michael" == Michael <>
>>>>> on Thu, 21 Dec 2006 11:08:15 -0600 writes:

    Michael> I stumbled upon this when using update()
    Michael> (specifically update.lm()).  If in the original
    Michael> call to lm(), say

    Michael> a <- lm (y ~ x + z, data = mydata)

    Michael> where y and z are in data frame mydata but x is in     Michael> the global environment.

    Michael> Then if later I run,

    Michael> a0 <- update (a, ~ . - z)

    Michael> a0$model will contain values of x in the global
    Michael> environment which may well be different, even
    Michael> different length from mydata$y.  Somehow, update()
    Michael> pads a0$model to have the same number of rows as
    Michael> the length of x.

    Michael> I would think that it would desirable to use x as     Michael> in a$model rather than the global one.

    Michael> Is this a bug or a deliberate feature?

    Michael> Thanks,

    Michael> Michael

    Michael> ______________________________________________
    Michael> mailing list     Michael> mailing list Received on Sat Dec 23 03:42:52 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 23 Dec 2006 - 14:31:03 GMT.

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