Custom build system for compiling rmarkdown files in sublime-text 3
Here is my custom build system for compiling rmarkdown files in sublime-text 3 on Linux.
"cmd": ["R", "-e", "library(knitr);rmarkdown::render(input = '$file',output_file = '$file_base_name.pdf')"], "selector": "text.html.markdown", "path": "/home/steve/.cabal/bin/:/home/steve/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" }
Obviously you will have to replace the /home/steve parts with your own path which has to include your pandoc installation path, otherwise pandoc will fail when you call it from Sublime Text. Took me a while to figure that out.
Bottom line: now I can write a markdown file in sublime which includes some knitr R chunks, and run it from sublime, without having to switch to rstudio. Very useful.