Re: [R] Tranferring R results to word prosessors

From: Marc Schwartz (via MN) <>
Date: Fri 10 Feb 2006 - 03:22:23 EST

In follow up to Harold's thought of using LaTeX, I have an approach when the use of nicely formatted tables is required in a document where LaTeX is not being used for the entire document. In other words, where you need to use Word,'s Writer or similar application for the majority of the document body.

This involves outputting R results to LaTeX table code in a text file, processing the file with 'latex' and 'dvips' and creating an EPS file. Of course, the LaTeX text file is fully complete with preamble, etc.

One can then import the EPS file to a page in the document processor file. The most recent versions of the aforementioned applications will generate a bitmapped preview of the table content to aid in placement and review.

You can then print the document to a PS printer or file for subsequent use.'s Writer can also use Ghostscript to print to a PDF file using a "PDF Converter" in the printer selection dialog. This, importantly, is different than the "Export to PDF" function. The latter does not properly print embedded EPS images and prints the bitmapped preview instead.

The advantage of this approach is that you don't have to mess around in the word processing program doing a 'text to table' conversion and then go through the formatting of the resultant columns, borders, etc.

HTH, Marc Schwartz

On Thu, 2006-02-09 at 09:47 -0500, Doran, Harold wrote:
> Well, I don't know if it can be used with Word or not, but you might
> consider Sweave for use with LaTeX. Maybe if you use the sink() command
> this might work, but I haven't tried it.
> -----Original Message-----
> From:
> [] On Behalf Of Tom Backer
> Johnsen
> Sent: Thursday, February 09, 2006 9:41 AM
> To:
> Subject: [R] Tranferring R results to word prosessors
> I have just started looking at R, and are getting more and more
> irritated at myself for not having done that before.
> However, one of the things I have not found in the documentation is some
> way of preparing output from R for convenient formatting into something
> like MS Word. An example: If you use summary(lm(....)) you get nice
> output. However, if you try to paste that output into the word
> processor, all the text elements are separated by blanks, and that is
> not optimal for the creation of a table (in the word processing sense).
> Is there an option to generate tab-separated output in R ? That would
> solve the problem.
> Tom mailing list PLEASE do read the posting guide! Received on Fri Feb 10 04:53:17 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:26 EST