[R] save the output of summary(lmList(x)) into a dataframe

Cecilia Carmo cecilia.carmo at ua.pt
Tue Jun 16 10:29:17 CEST 2009


Hi r-helpers!

I need to save the output of summary() function that I’ve 
runned like this:
z<- lmList(y~x1+x2| x3, 
na.action=na.omit,data1,subset=year==1999)
w<-summary(z)
The output (w) is something like this:
Call:
   Model: y ~ x1 + x2 | x3
    Data: data1
Coefficients:
    (Intercept)
         Estimate    Std. Error       t value  Pr(>|t|)
1    0.081110514  1.141352e-01  7.106531e-01 0.4774081
2    0.384008008           NaN           NaN       NaN
5   -0.127962259           NaN           NaN       NaN
14   0.828115409  6.888789e-01  5.427381e-02 0.9567241


x1
         Estimate    Std. Error       t value  Pr(>|t|)
1    58.06999452 137.263534154  4.230548e-01 0.6723151
2  -202.45105435           NaN           NaN       NaN
5            NaN           NaN           NaN       NaN
14    0.12776835   0.047486161  1.262510e-02 0.9899286


x2
        Estimate    Std. Error       t value     Pr(>|t|)
1  -0.173986693  2.126186e-01 -8.183043e-01 4.133115e-01
2  -0.630343567           NaN           NaN          NaN
5           NaN           NaN           NaN          NaN
14  0.737871169 -3.203230e+01  3.840265e+01 0.000000e+00


Residual standard error: 0.2261486 on 1522 degrees of 
freedom

I would like to have this output  in a dataframe like 
this:
x3  intercept  x1   x2   Std. Error   t value   Pr(>|t|)
1           

2
5
14



Anyone knows if it is possible and how?

Thanks in advance,

Cecília Carmo (Universidade de Aveiro – Portugal)




More information about the R-help mailing list