I wrote earlier about using Rakefiles with Pandoc. Now that I’m engaged in writing a series of posts on historical history dissertations, I have another problem that Rake can solve. Each of the blog posts for the series is written in R Markdown, which lets me mix R code and writing together in a kind of literate programming or research notebook. Then the fabulous knitr package by Yihui Xie runs the code to create a combination of writing and output in a Markdown file.
Let’s assume that you have a set of R Markdown files in your project directory, and that you want to knit them without loading any .Rdata or .Rprofile files so that your research is reproducible. You can do this by with a Rakefile like this:
I have some additional options for this kind of project Rakefile, which you can [see here](https://github.com/lmullen/dissertations-data/blob/master/Rakefile). Mostly they run data munging scripts and define cleaning tasks.