How do I generate a document (.rtf, .doc, .odt) from R How do I generate a document (.rtf, .doc, .odt) from R r r

How do I generate a document (.rtf, .doc, .odt) from R


The standard Sweave engine is one option if you can handle LaTeX - but I guess that is stretching the "word-processor file" aspect just a touch! Alternatively, odfWeave is a related package providing a new engine for Sweave that will work with OpenOffice.org documents.

There are other options on the Reproducible Research Task View on CRAN, although some of the MS Office oriented options require Windows specific cruft.


Here is my solution. It uses Sweave with reStructuredText markup which allows easy generation of odf, Latex and HTML documents from a single source. See here for different writers included in docutils.

There is also rst2wordml writer that doesn't implement all the features of rest, but you may find it also useful. It works with the example from my blog (first link) if you remove the table of contents directive.