Installing Pandoc from R (on Windows) – using the {installr} package

February 27, 2013
By

(This article was first published on R-statistics blog » RR-statistics blog, and kindly contributed to R-bloggers)

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.

The install.pandoc() function, as the name implies, will recognize the latest version of pandoc, download its installer to your computer, and run it. Making it even simpler for you to experiment with adding pandoc into your workflow.

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!

pandoc_diagram

To leave a comment for the author, please follow the link and comment on his blog: R-statistics blog » RR-statistics blog.

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...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.