(This article was first published on

In a previous post (a long time ago) I discussed a way to get a R data frame into a Word table. The code in that entry was essentially a brute force way of wrapping R data in RTF code, but that RTF code was the bare minimum. There was no optimization of widths, or borders, or anything like that.**Realizations in Biostatistics**, and kindly contributed to R-bloggers)There are a couple of other ways I can think of:

- Writing to CSV, then opening in MS Excel, then copying/pasting into Word (or even saving in another format)
- Going through HTML to get to Word (for example, the R2HTML package)
- Using a commercial solution such as Inference for R (has this been updated since 2009?!)
- Using Statconn, which seems broken in the later versions of Windows and is not cross platform in any case
- Going through LaTeX to RTF

- Use cat statements and the latex command from the Hmisc package (included with every R installation) or xtable package (downloadable from CRAN) to create a LaTeX document with the table.
- Call the l2r command included with the LaTeX2RTF installation. (This requires a bit of setup, see below.)
- Open up the result in Word and do any further manipulation.

I must admit, though, here is one area where SAS blows R away. With the exception of integration into LaTeX, and some semisuccessful integration with Excel through the Statconn project, R’s reporting capabilities in terms of nicely formatted output is seriously outpaced by SAS ODS.

To

**leave a comment**for the author, please follow the link and comment on his blog:**Realizations in Biostatistics**.R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...