[R] question about update()

Adelchi Azzalini @zz@||n| @end|ng |rom @t@t@un|pd@|t
Thu May 4 10:05:10 CEST 2023

Hi. There must be something about the use of update() which I do not grasp,
as the next exercise indicates.

Suppose that obj is an object returned by a call to lm() or glm().
Next, a new variable xf is constructed using the same dataframe used 
for producing obj. Then

obj$data <- cbind(obj$data, xf=xf)
new.obj <- update(obj, . ~ . + xf) 


Error in eval(predvars, data, env) : object 'xf' not found

Could somebody explain what I got wrong, and how to fix it?

Best regards,

Adelchi Azzalini

More information about the R-help mailing list