Integrating R Code in Beamer Presentations

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.

Rwrkshp

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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: