[Rd] update.default bugfix (PR#3288)
Thomas Lumley
tlumley at u.washington.edu
Thu Jun 19 08:46:11 MEST 2003
On Wed, 18 Jun 2003 minka at stat.cmu.edu wrote:
> According to the man page for formula, "a formula object has an associated
> environment". However, update.default doesn't use this environment, which
> creates problems like the following:
>
> make.model <- function(x) { lm(medv~.,x) }
> library(MASS)
> data(Boston)
> fit = make.model(Boston)
> fit = update(fit,".~.-crim")
> # Object "x" not found
Update isn't going to satisfy everyone because people want it to do
incompatible things. However, I don't think this is one of the things it
should be able to do.
In general the environment of a formula is used to look up variables in
the formula, not the data= argument. (It's also used to look up the
weights= and subset= arguments, but that is a horrible wart that we would
like to excise).
-thomas
More information about the R-devel
mailing list