Skip to content
Prev 166324 / 398502 Next

Two Noobie questions

You can also use subscripts to get at things with a bit of playing around.
Call:
lm(formula = x ~ seq(1, length(x), 1))

Residuals:
     Min       1Q   Median       3Q      Max 
-40.0961 -15.5289  -0.6489  12.7488  41.0107 

Coefficients:
                       Estimate Std. Error t value Pr(>|t|)    
(Intercept)          165.259602   1.620906 101.955   <2e-16 ***
seq(1, length(x), 1)  -0.048711   0.005551  -8.775   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 

Residual standard error: 18.19 on 503 degrees of freedom
Multiple R-squared: 0.1328,     Adjusted R-squared: 0.131 
F-statistic:    77 on 1 and 503 DF,  p-value: < 2.2e-16
[1] 0.005551145
[1] -0.04871091
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of AllenL
Sent: 06 January 2009 19:48
To: r-help at r-project.org
Subject: Re: [R] Two Noobie questions


Thanks for your help!

I combined the above two to get the following, which seems to work (if somewhat inelegant):

int.List<-unlist(lapply(lmList, function(x) {coef(x)[1]}),use.names=FALSE) lmList is my list of lm objects. 
-Allen
David Winsemius wrote: