KnitR is a really important tool for reproducible research. You create documents that are a mixture of text and code; when processed through KnitR, the code is replaced by the results and/or figures produced.

Yihui Xie, the developer of KnitR, has written clear and thorough documentation, many useful examples and demos, and a very nice book. Nevertheless, I thought it might be useful to have some of the basic things explained again a bit differently.

And so, here is a brief guide to KnitR, covering the fundamentals of its use with Markdown, AsciiDoc, and LaTeX.

If you find KnitR useful, consider buying Yihui’s book.

The source for this tutorial is here. If you have suggestions or corrections, please submit an issue.

Also see my tutorials on git/github, GNU make, R packages, making a web site with GitHub Pages, data organization, and reproducible research.