Marco M
Marco M

Reputation: 623

Creating reports in R

I've posted a similar question on Rstudio but I thought it would be useful to also ask stack users.

My question is basically this: how do you create documents with embedded R graphics that others can easily comment on?

In the past few months I've been wondering how to circulate R analysis within my company quickly without having to paste lots of plots and tables from R. I'm not interesting in embedding R code, but I do want to be able to customise where my plots go and write text around it (title, headings and paragraphs) from R. The package R2wd has huge potential but Rstudio is making the whole production of high quality documents in HTML, pdf and Latex much more intuitive. These formats are generally much more flexible, look better, and take full advantage of R's capabilities.

There are functions generally (but not necessarily correctly) associated with Word which make me (and again I may be wrong) not likely to switch to these other formats. Once the analysis is finished it is then uploaded on a common drive or circulated electronically, and then colleagues/supervisors/ can:

  1. review the document with Track changes (i.e. edit the text and then leave you the option to accept changes or not), and
  2. Comment on sections of the text (comments).

These two functions are absolutely crucial when publishing reports on the go (especially new types of analyses which have not been reviewed before), and I was wondering how you'd go about doing this in the formats currently supported by Rstudio (e.g. HTML, latex, pdf), or just how you generally deal with these issues . I'd love to switch to better formats like pdf but I don't know whether it would mean losing the two functions above.

Upvotes: 9

Views: 2709

Answers (4)

Greg Snow
Greg Snow

Reputation: 49640

In conjunction with the tools that you have discussed (rstudio and sweave/knitr) you might want to look at the pandoc program which will convert from the formats created by those tools into other tools including word .docx files (and others). So one option would be to create a basic template file in R or Rstudio and use the built in tools to work with and view it while creating it. Then when you are ready to share the document (with embedded graphs, output, etc.) you can convert to a .docx file and colaboraters can comment and track changes.

Other options would be to use R2wd (as mentioned in the question, but note that it uses non-free tools) or R2HTML or rtf packages to create those types of files which can be read in using ms word as well.

Upvotes: 5

Karsten W.
Karsten W.

Reputation: 18420

Maybe you can import the knitr'ed HTML into Google Docs. There you have not only track changes but real time editing. I did not try this, though.

Upvotes: 2

Sam
Sam

Reputation: 4497

Here is my thought about your question. Regarding writing a reproducible report (or data analysis), as Dirk has recommended, I would recommend using knitr or Sweave (I personally like knitr more). In the company I work, I write all my reports in a reproducible format so that it enables people to reproduce my research as well as helping me to easily change some parameters {in my case dosage of using our product} an getting a new report in just a second.

Regarding the editing and proofreading part, you can use http://www.mendeley.com/. I do have a private group on Mendeley with my team and I share my reports with them and they can easily comment on the report. We can also share documents with each other. It's quite useful to me.

Upvotes: 1

Dirk is no longer here
Dirk is no longer here

Reputation: 368201

Have a look at Sweave (in base R) and the knitr ---and everything in the CRAN Task View on Reproducible Research which focusses on the very same topic.

Upvotes: 3

Related Questions