Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Processing R markdown (Rmd) documents with Eclipse/StatET external tools requires a different setup than processing ‘regular’ knitr documents (Rnw). I was having problems getting the whole rmarkdown -> pandoc workflow working on Eclipse, but the following fix seems to have resolved it, and I can generate Word or HTML documents from a single .Rmd file with a YAML header (see image below).
For starters, I open the Run > External Tools > External Tools Configurations window. The Rmarkdown document is considered a type of Wikitext, so create a new Wikitext + R Document Processing entry. To do that, hit the little blank-page-with-a-plus icon found in the upper left corner of the window, above where it says “type filter text”.
Enter a name for this configuration in the Name field (where it says knitr_RMD_yaml in my image above). I then used the Load Preset/Example menu in the upper right to choose the “Auto (YAML) using RMarkdown, single-step” option. This processes your .Rmd document directly using the rmarkdown::render() function, skipping over a separate knitr::knit() step, but the output should look the same.
Next go to the “2) Produce Output” tab (you are skipping over the “1) R-Weave” tab because you chose the 1-step process). By default the entry in the File field here was causing errors for me. The change is pictured below, so that the File entry reads "${file_name_base:${source_file_path}}.${out_file_ext}"
. This change allowed my setup to actually find the .Rmd and output .md files successfully, so that the .md document could then be passed on to pandoc.
This all assumes that you’ve previously downloaded and installed pandoc so that it can be found on the Windows system $PATH.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.