I am preparing presentations for the upcoming R workshop. That means I have to find a way to integrate R code and results into my presentations. Now I know there are a number of ways to achieve this, but I like beamer for presentations and R for analysis. Now thanks to Knitr, I can bring together my two most favorite pieces of software.

Follow a few simple steps, and you are golden.

  • take your regular beamer presentation and change the file extension to .Rnw.
  • Initialize the frame with fragile option like so begin{frame}[fragile]
  • Enclose your R code in a chunk like so <<parameters here>>= CODE HERE @
  • Knit with Knitr in R

The results look marvelous.


There are certain parameters to control suppression of code display,  output, or scaling of images. Those can be discovered following the example of Yihui Xie.