The knitr package provides an easy way to embed
R code in a Jekyll-Bootstrap
blog post. The only required input is an R Markdown source file.
The name of the source file used to generate this post is 2012-07-03-knitr-jekyll.Rmd, available
Steps taken to build this post are as follows:
Create a Jekyll-Boostrap blog if you don’t already have one.
A brief tutorial on building this blog is available
Open the R Console and process the source file:
Move the resulting image folder 2012-07-03-knitr-jekyll and Markdown file
2012-07-03-knitr-jekyll.md to the local
The KnitPost function assumes that the image folder will be placed in a
folder located at the root of the repository.
Add the following CSS code to the
/assets/themes/twitter-2.0/css/bootstrap.min.css file to center images:
Here are a few examples of embedding R code:
Figure 1: Caption
Figure 2: Caption
And don’t forget your session information for proper reproducible research.