Like many R users, I collaborate with colleagues who prefer docx and pptx file formats. My usual work flow has been to use RStudio/knitr/LaTeX (.Rnw files) to produce a PDF document that I send ’round to my colleagues for review and comment. While my work is reproducible, PDFs are not the most convenient format for iterative review and comment.
At user!2014 I learned of two methods to create docx files dynamically: rmarkdown and ReporteRs. I worked with both packages for a couple of days and can offer this initial assessment. In brief, ReporteRs provides superior control of document design but requires additional (and somewhat awkward, though effective) markup; rmarkdown provides less control of document design but is more human-readable, consistent with literate programming principles. The full set of test files are on github.
Both systems permit me to use a docx document as a template for styles formatting. ReporteRs really shines here. I can open a new file in Word, make adjustments to typeface styles, margins, headers, etc., save the file, and invoke it as a template in the markup file. Easy and effective. In contrast, rmarkdown requires that I use rmarkdown to create the docx document, edit only the styles that appear there, then I can save it and invoke it as a template in the next run. However, margin changes in the template were ignored by rmarkdown and inserting a logo into the template header caused an error. These might be correctable, but solutions were not obvious during the time I devoted to testing.
ReporteRs also provides superior control over table layouts and produces pptx files. Some R users will undoubtedly find reproducible pptx files a real boon to their work flow.
One aspect of ReporteRs I found annoying (though understandable) is that every paragraph of text has to be defined; the markup looks like addParagraph(docName, "This is a paragraph", stylename = "Normal"). My complaint is that because paragraphs are the basic units of writing, their expression as paragraphs should not be cluttered with markups. Even LaTeX honors this convention; and so does rmarkdown—a paragraph looks like a paragraph and is easy to read.
Based on my initial encounter with both packages, I would consider using ReporteRs if I’m responsible for preparing a reproducible, publication-ready, docx document that conforms to a prescribed format (a corporate report, for example). But for review and feedback from collaborators, where exquisite control of document design is less critical, I’d recommend rmarkdown. And I have successfully translated a previous, full report from .Rnw to .Rmd with excellent results.
For solo work, however, no docx for me! I’m sticking with .Rnw.