[R] list of lm() results

David Winsemius dwinsemius at comcast.net
Tue Jul 21 18:53:48 CEST 2009


On Jul 21, 2009, at 12:27 PM, Idgarad wrote:

> 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.

?"[["

You are trying to use a vector/array  assignment operator, "[<- ",   
when you should be using a list assignment operator, "[[<-".


David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list