{"id":2395,"date":"2017-10-02T14:06:29","date_gmt":"2017-10-02T21:06:29","guid":{"rendered":"http:\/\/lukemiller.org\/?p=2395"},"modified":"2017-10-02T14:06:29","modified_gmt":"2017-10-02T21:06:29","slug":"processing-rmarkdown-documents-with-eclipse-and-statet","status":"publish","type":"post","link":"https:\/\/lukemiller.org\/index.php\/2017\/10\/processing-rmarkdown-documents-with-eclipse-and-statet\/","title":{"rendered":"Processing Rmarkdown documents with Eclipse and StatET"},"content":{"rendered":"<p>Processing R markdown (Rmd) documents with Eclipse\/StatET external tools requires a different setup than processing &#8216;regular&#8217; 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).<\/p>\n<figure id=\"attachment_2396\" aria-describedby=\"caption-attachment-2396\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2017\/10\/Rmd_for_docx.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2017\/10\/Rmd_for_docx-300x120.png\" alt=\"\" width=\"300\" height=\"120\" class=\"size-medium wp-image-2396\" srcset=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2017\/10\/Rmd_for_docx-300x120.png 300w, https:\/\/lukemiller.org\/wp-content\/uploads\/2017\/10\/Rmd_for_docx.png 762w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-2396\" class=\"wp-caption-text\">A .Rmd document with YAML header set to produce a Microsoft Word .docx output file.<\/figcaption><\/figure>\n<p>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 &#8220;type filter text&#8221;. <\/p>\n<figure id=\"attachment_2397\" aria-describedby=\"caption-attachment-2397\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2017\/10\/minimal_working_yaml_1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2017\/10\/minimal_working_yaml_1-300x158.png\" alt=\"\" width=\"300\" height=\"158\" class=\"size-medium wp-image-2397\" srcset=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2017\/10\/minimal_working_yaml_1-300x158.png 300w, https:\/\/lukemiller.org\/wp-content\/uploads\/2017\/10\/minimal_working_yaml_1-768x406.png 768w, https:\/\/lukemiller.org\/wp-content\/uploads\/2017\/10\/minimal_working_yaml_1-1024x541.png 1024w, https:\/\/lukemiller.org\/wp-content\/uploads\/2017\/10\/minimal_working_yaml_1.png 1134w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-2397\" class=\"wp-caption-text\">Using the Auto (YAML) single-step preset.<\/figcaption><\/figure>\n<p>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 &#8220;Auto (YAML) using RMarkdown, single-step&#8221; 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. <\/p>\n<p>Next go to the &#8220;2) Produce Output&#8221; tab (you are skipping over the &#8220;1) R-Weave&#8221; 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 <code>\"${file_name_base:${source_file_path}}.${out_file_ext}\"<\/code>. 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. <\/p>\n<figure id=\"attachment_2398\" aria-describedby=\"caption-attachment-2398\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2017\/10\/minimal_working_yaml_2.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2017\/10\/minimal_working_yaml_2-300x178.png\" alt=\"\" width=\"300\" height=\"178\" class=\"size-medium wp-image-2398\" srcset=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2017\/10\/minimal_working_yaml_2-300x178.png 300w, https:\/\/lukemiller.org\/wp-content\/uploads\/2017\/10\/minimal_working_yaml_2-768x457.png 768w, https:\/\/lukemiller.org\/wp-content\/uploads\/2017\/10\/minimal_working_yaml_2-1024x609.png 1024w, https:\/\/lukemiller.org\/wp-content\/uploads\/2017\/10\/minimal_working_yaml_2.png 1038w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-2398\" class=\"wp-caption-text\">Modify the File entry from the default so that instead reads the same as what&#8217;s pictured here.<\/figcaption><\/figure>\n<p>This all assumes that you&#8217;ve previously downloaded and installed pandoc so that it can be found on the Windows system $PATH. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Processing R markdown (Rmd) documents with Eclipse\/StatET external tools requires a different setup than processing &#8216;regular&#8217; 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 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[218],"tags":[],"class_list":["post-2395","post","type-post","status-publish","format-standard","hentry","category-r-project"],"_links":{"self":[{"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/posts\/2395","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/comments?post=2395"}],"version-history":[{"count":5,"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/posts\/2395\/revisions"}],"predecessor-version":[{"id":2403,"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/posts\/2395\/revisions\/2403"}],"wp:attachment":[{"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/media?parent=2395"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/categories?post=2395"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/tags?post=2395"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}