First make sure that myResults is a list (you probably did this, but just to be 
sure):

> myResults <- list()

Then use doubled brackets [[]]:

> myResults[[1]] <- lm(...)
Etc.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Idgarad
> Sent: Tuesday, July 21, 2009 10:28 AM
> To: r-help@r-project.org
> Subject: [R] list of lm() results
> 
> How can I get the results of lm() into a list so I can loop through the
> results?
> 
> e.g.
> 
> myResults[1] <- lm(...)
> myResults[2] <- lm(...)
> myResults[3] <- lm(...)
> ...
> myResults[15] <- lm(...)
> myResults[16] <- lm(...)
> 
> so far every attempt I've tried doesn't work throwing a "number of
> items to replace is not a multiple of replacement length" error or
> simply not working.
> 
> ______________________________________________
> R-help@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.

______________________________________________
R-help@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.

Reply via email to