Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The R blogger Rolf Fredheim has recently wrote a great piece called “Reproducible research with R, Knitr, Pandoc and Word“, where he advocates for Pandoc as an essential part of reproducible research workflow in R, in helping to turn documents which are knitted in R into high quality Word for exchanging with our colleagues. It is a great post, with many useful bits of code, and I wanted to supplement it with one missing function: “install.pandoc“.

Update: the install.pandoc function is now part of the {installr} package.

Here is how to use it:

   # installing/loading the package: if(!require(installr)) { install.packages("installr"); require(installr)} #load / install+load installr   # Installing pandoc install.pandoc(use_regex = FALSE) # The use of use_regex here is due to a change in pandoc download page. This parameter will not be needed in installr versions after 0.9

Note: the code in this function is based on GERGELY DARÓCZI’s coding in his answer on the Q&A forum StackOverflow, and also G. Grothendieck for the non-XML addition to the function. I thank them both!