[R] Odp: What is the best way to have "R" output tables in an MS Word format?

Chris Evans chrishold at psyctc.org
Mon May 3 15:30:09 CEST 2010


Thanks Tal/Petr, I regularly use the clipboard option but for most of
what I do people would prefer to see things in proportional fonts and
I'd love to be able to reformat tabulations easily to get nice layouts.

Of course, I've got very adept at global search and replace of
successive spaces with tabs then replacing successive tabs with single
tabs until I have tables starting to be tabbed as I'll need them to then
use Word's Table Convert ... and them I'm where I'd like to have been
and can start dragging to get columns looking right, applying bold (say)
to particular columns etc.

For a lot of what I do that means that I've done some nice
mathematical/statistical work in R in seconds, some of that is fairly
trivial and some of uses the wonders of R that trump SPSS on so many
grounds of logic, extensibility, power, object orientation etc. and
sometimes, particularly with graphics, or things that need to be
replicated over groups etc. you can get gasps of awe from even quite
serious SPSS adepts.

However, having done that in seconds, I then spend minutes, sometimes
many minutes, formatting text to get output that matches for numbers the
glories of R's graphics. By contrast, when I was using SPSS and with its
admittedly very limited output, I could pretty much just copy with the
clipboard, paste and can reformat in seconds and most things like ANOVA
results and correlation matrices would be tabbed.

It does look to me as if sword and R2wd might come to do a lot of what
I'd like I think one thing that would help that greatly would be the
ability to add the tab character to the supported output of R.  More on
why I'd vote for this being in the R core not in packages separately.

Chris



Tal Galili sent the following  at 03/05/2010 10:42:
> To continue Petr suggestion, a simple variation for this would be to use
> sink()
> 
> 
> ----------------Contact
> Details:-------------------------------------------------------
> Contact me: Tal.Galili at gmail.com |  972-52-7275845
> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
> www.r-statistics.com (English)
> ----------------------------------------------------------------------------------------------
> 
> 
> 
> 
> On Mon, May 3, 2010 at 11:43 AM, Petr PIKAL <petr.pikal at precheza.cz> wrote:
> 
>> Hi
>>
>>
>> r-help-bounces at r-project.org napsal dne 01.05.2010 00:13:06:
>>
>>> Dear "R" list,
>>>
>>> Our statisticians usually give us results back in a PDF format. I would
>> like
>>> to be able to copy and past tables from "R" output directly into a
>> Microsoft
>>> Word table since this will save us tons of time, be more accurate to
>>> minimize human copying errors and help us update data in our papers more
>>> easily.
>>
>> Others gave you more sophisticated solutions which can pay out in longer
>> time and when you use the output quite often. However there is one simple
>> approach
>>
>> select output in R console
>> ctrl C
>> open Word
>> ctrl V
>> format text as (I believe) Courier
>>
>> This usually aligns text in proper way to columns.
>>
>> Regards
>> Petr
>>
>>>
>>> Do people have suggestions for the best way to do this?
>>>
>>> I am a novice to "R" but I do work with a couple of
>>> very knowledgeable statisticians who do most of the heavy statistical
>>> lifting for our research group.
>>>
>>> Many thanks,
>>> Max
>>>
>>>
>>> Max Gunther, PhD
>>>
>>> Vanderbilt University - Radiology
>>> Institute of Imaging Sciences - VUIIS
>>> Center for Health Services Research
>>> Nashville, TN www.ICUdelirium.org
>>>
>>>    [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> 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.
>>
>> ______________________________________________
>> 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.
>>
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.
> 




-- 
Chris Evans <chris at psyctc.org> Skype: chris-psyctc
Consultant Psychiatrist in Psychotherapy, Notts. PDD network;
Trust Research Governance Lead and Clinical Director, Psychological
  Therapies Directorate in Local Services, Nottinghamshire NHS Trust;
Professor, Psychotherapy, Nottingham University
*If I am writing from one of those roles, it will be clear. Otherwise*
*my views are my own and not representative of those institutions    *
If you have difficulty Emailing me on this address or getting a reply,
send again but cc to:       chris dot evans at nottshc dot nhs dot uk
and to:                     c dot evans at nottingham dot ac dot uk



More information about the R-help mailing list