[Rd] variable scope in update(): bug or feature?
Martin Maechler
maechler at stat.math.ethz.ch
Fri Dec 22 09:17:21 CET 2006
Hi Michael,
can you please
- use a simple reproducible example --
just for the convenience of your readers
- use R-help. This is really a question about R.
>>>>> "Michael" == Michael <wuolong at gmail.com>
>>>>> 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> R-devel at r-project.org mailing list
Michael> https://stat.ethz.ch/mailman/listinfo/r-devel
More information about the R-devel
mailing list