[R] effects: error when original data frame is missing

Gerrit Eichner Gerrit.Eichner at math.uni-giessen.de
Wed Jan 17 10:55:40 CET 2018

Hello, everyody,

when asking, e.g., Effect() to compute the effects of a fitted,
e.g., linear model after having deleted the data frame from the
workspace for which the model was obtained an error is reported:

 > myair <- airquality
 > fm <- lm(Ozone ~ Temp, data = myair)
 > rm(myair)
 > Effect("Temp", fm)
Error in eval(model$call$data, envir) : object 'myair' not found

Has anybody a better "workaround" for this than, e.g., explicitly
saving the fitted model object fm together with its original
environment or just the data needed frame (maybe in a list like
fm.plus.origdata <- list(fm, myair = myair)) to be able to restore
the original environemt (or at least the needed opriginal data
frame) of the time when fm was created?

Thx for any hint!

  Regards  --  Gerrit

Dr. Gerrit Eichner                   Mathematical Institute, Room 212
gerrit.eichner at math.uni-giessen.de   Justus-Liebig-University Giessen
Tel: +49-(0)641-99-32104          Arndtstr. 2, 35392 Giessen, Germany
Fax: +49-(0)641-99-32109            http://www.uni-giessen.de/eichner

More information about the R-help mailing list