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

Joshua Wiley jwiley.psych at gmail.com
Fri Jul 2 20:34:04 CEST 2010


On Fri, Jul 2, 2010 at 10:59 AM, Yi <liuyi.feier at gmail.com> wrote:
> Hi,
>
> I attached a picture to compare the 'mess' to what I what.
>
> Maybe there is difference between computers?
>
> Thanks.
>
> On Fri, Jul 2, 2010 at 10:52 AM, David Winsemius <dwinsemius at comcast.net>wrote:
>
>>
>> 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.

Did you try David's suggestion?  If you are using a recent version of
Office or Windows they come installed with Courier New and Consola
which are both monospaced fonts that should work.  If you have none of
these, just go through trying the fonts you do have or a quick search
on google will lead you to numerous free monospaced fonts you can
download and use.


>> --
>>
>> David Winsemius, MD
>> West Hartford, CT
>>
>>
>
> ______________________________________________
> 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.
>
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/



More information about the R-help mailing list