[R] how to save summary(lm) and anova (lm) in format?

David Winsemius dwinsemius at comcast.net
Fri Jul 2 19:52:50 CEST 2010


On Jul 2, 2010, at 1:34 PM, Yi wrote:

> Hi, folks,
>
> I would like to copy the output of summary(lm) and anova (lm) in R  
> to my
> word file. But the output will be a mess if I just copy after I call  
> summary
> and anova.

A mess in what way exactly?

>
> #####################
> x=rnorm(10)
> y=rnorm(10,mean=3)
> lm=lm(y~x)
> summary(lm)
>
> Call:
> lm(formula = y ~ x)
> Residuals:
>      Min        1Q    Median        3Q       Max
> -1.278567 -0.312017  0.001938  0.297578  1.310113
> Coefficients:
>            Estimate Std. Error t value Pr(>|t|)
> (Intercept)   2.5221     0.2272  11.103 3.87e-06 ***
> x            -0.5988     0.2731  -2.192   0.0597 .
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> Residual standard error: 0.7181 on 8 degrees of freedom
> Multiple R-squared: 0.3753,     Adjusted R-squared: 0.2972
> F-statistic: 4.807 on 1 and 8 DF,  p-value: 0.0597
> ####################
>
> How can I get the exact ouput as shown in R but not as the above?

Looks completely standard to me. (Viewed in Courier.) I suspect you  
have copied this into some device that uses proportional fonts. Try  
selecting it and changing the font to Courier or Monaco.
--

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list