[R] writing lm summary to file?

John-J.Smith@ubs.com John-J.Smith at ubs.com
Wed Oct 27 21:17:19 CEST 2004


Hi,

I want to write the summary from a regression.  I am doing this because I do not see a way of get the std error, tvalues from the coefficients diagnostic.  n$coef does not give this only get the intercept and slope.  I tried to use write and write.table and got error in both cases.  I jumped thru the hoops below to no avail.  Also note, this is in windows.  I used to use unix, and do not recall this problem, but only have windows at this point.  Any suggestions are greatly appreciated.

John


> n<-lm(formula = A ~ B, data = y)
> summary(n)

Call:
lm(formula = A ~ B, data = y)

Residuals:
    Min      1Q  Median      3Q     Max 
-5.0165 -0.9726 -0.4707  1.7783  3.8563 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)   
(Intercept)  1.15072    0.38135   3.017  0.00506 **
B        0.18042    0.05254   3.434  0.00171 **
---
Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 

Residual standard error: 2.14 on 31 degrees of freedom
Multiple R-Squared: 0.2755,     Adjusted R-squared: 0.2522 
F-statistic: 11.79 on 1 and 31 DF,  p-value: 0.001711 

> help(write.table)

> write.table(summary(n),file ="C\\....")
Error in as.data.frame.default(x[[i]], optional = TRUE) : 
        can't coerce summary.lm into a data.frame
> help(write)

> write(summary(n),file ="C\\..")
Error in cat(list(...), file, sep, fill, labels, append) : 
        argument 1 not yet handled by cat

Visit our website at http://www.ubs.com

This message contains confidential information and is intend...{{dropped}}




More information about the R-help mailing list