Knitr beats the socks off of an iPython notebook. Both tools do the same job, but knitr doesn't require you to leave your established text editor workflow.
Tested specifically on OS X 10.9, with R 3.1.2 and Anaconda python distribution.
- Calling an R script from the terminal will use the python version currently in the system
PATH
. If you need to specify a python 3.x or python 2.x environment, make your life easier and do it from the command line before you do anything else.
source activate py3k
- (optional sublimetext steps)
- Open up sublime text via command line in the directory of interest. This loads sublimetext with the
PATH
variables you just set.
cd ~/git/directory
subl .
- install Sublime Knitr (https://github.com/andrewheiss/SublimeKnitr) for convenience builds.
- using template.Rmd in this gist, build your script. Save your file as
fileName.Rmd
. cmd
+B
to build using sublimetext. Will output tofileName.md
with an adjacentfigure/
directory if you have images.
- Otherwise, if you're not in sublimetext, build your script from whatever, save as
fileName.Rmd
, and run the following command in your source activated terminal:
Rscript -e "library(knitr); knit('myfile.Rmd')"
h/t Maiasaura on stack overflow