See ?save for one way to save models for later re-reading.
I don't fully understand your next question, many of the modeling functions
have options for saving the data (see ?lm), but can you give an example for your
A, B, and C example? Then we will have a better chance of telling you what is
happening and what options can change what is happening.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Sharma, Dhruv
> Sent: Monday, September 29, 2008 1:52 PM
> To: r-help at r-project.org
> Subject: [R] persistence of model in R to a file
>
> Hi,
> Is there a way to save R models (glm, lm , rpart etc) in a file
> that
> be read in later?
>
> I noticed models take up space. by space them off and removing them
> from memory it seems that would be useful.
>
> Also why do the models keep a copy of all columns in the original
> data set even those columns are not in the model.
> E.g. if I build a model on columns A, B even thought column C
> exists
> in the dataframe when I run the model against test data with only
> columns A and B then I get an error saying column C is missing from the
> data.
>
> Anyway it seems like the models would be more compact without
> having
> to include within them data from the original data set used to build
> them but that is an aside.
>
> If models can be persisted and loaded selectively later that would
> neat.
>
>
> thanks
> Dhruv
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.