[R] list of lm() results

Giovanni Petris GPetris at uark.edu
Tue Jul 21 23:49:42 CEST 2009


My guess is that you did not define the list correcly before making
any assignments to it. Try something like

> myResults <- vector("list", 16)

and then your code

> myResults[1] <- lm(...)
> myResults[2] <- lm(...)
> myResults[3] <- lm(...)
 ...
> myResults[15] <- lm(...)
> myResults[16] <- lm(...)

HTH,
Giovanni

> Date: Tue, 21 Jul 2009 11:27:52 -0500
> From: Idgarad <idgarad at gmail.com>
> Sender: r-help-bounces at r-project.org
> Precedence: list
> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
> DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
> 
> 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 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.
> 
> 

-- 

Giovanni Petris  <GPetris at uark.edu>
Associate Professor
Department of Mathematical Sciences
University of Arkansas - Fayetteville, AR 72701
Ph: (479) 575-6324, 575-8630 (fax)
http://definetti.uark.edu/~gpetris/




More information about the R-help mailing list