[R] extract data from lm object and then use again?

2006-09-22 Thread Mike Wolfgang
Hi list, I want to write a general function so that it would take an lm object, extract its data element, then use the data at another R function (eg, glm). I searched R-help list, and found this would do the trick of the first part: a.lm$call$data this would return a name object but could not be

Re: [R] extract data from lm object and then use again?

2006-09-22 Thread Thilo Kellermann
Hi, the data of the model fit is stored in lm$model and should work Good luck, Thilo On Friday 22 September 2006 16:45, Mike Wolfgang wrote: Hi list, I want to write a general function so that it would take an lm object, extract its data element, then use the data at another R function

Re: [R] extract data from lm object and then use again?

2006-09-22 Thread Marc Schwartz (via MN)
On Fri, 2006-09-22 at 10:45 -0400, Mike Wolfgang wrote: Hi list, I want to write a general function so that it would take an lm object, extract its data element, then use the data at another R function (eg, glm). I searched R-help list, and found this would do the trick of the first part:

Re: [R] extract data from lm object and then use again?

2006-09-22 Thread Thomas Lumley
On Fri, 22 Sep 2006, Thilo Kellermann wrote: Hi, the data of the model fit is stored in lm$model and should work Not reliably. In the first place, you should use the accessor function model.frame(model) rather than model$model, which works even if the model was fitted with model=FALSE.

Re: [R] extract data from lm object and then use again?

2006-09-22 Thread Prof Brian Ripley
On Fri, 22 Sep 2006, Thomas Lumley wrote: On Fri, 22 Sep 2006, Thilo Kellermann wrote: Hi, the data of the model fit is stored in lm$model and should work Not reliably. In the first place, you should use the accessor function model.frame(model) rather than model$model, which works