RPres Tutorial

K Chandirasekaran

Getting Started

To create a new R Presentation you execute the File -> New File -> R Presentation command:

After specifying the location to save the presentation, a new presentation will be created and a preview will show within the Presentation tab in the upper right corner of the IDE.

Slide Basics

Slides are composed using markdown and delimited by section headings that use =============.

The very first slide in a deck is the title slide. It will automatically be displayed with a larger heading (H1) and a special background color. It can also include special author and date fields. For example:

To create a slide with bullets you simply use standard Markdown bullets:

Slides automatically display their titles unless title: false is specified. For example:

R Code Chunks

Since they are R Markdown documents, R Presentations can include R code chunks. Code chunks can be used as a means of displaying code for illustration or to actually render output into slides. Here is a simple R code chunk that will result in both the code and it's output being included in the slide:

Displaying Code Only

To display R code without evaluating it, you specify the eval=FALSE option:

Displaying Output Only

To display the output of a code chunk but not the underlying R code, you specify the echo=FALSE option:

Note that R code chunks can also be used to include plots within Presentations. To display a plot while omitting the code used to generate the plot you'd do this:

Images

You can embed images within slides using standard markdown syntax. For example:

If you want to float an image to the left or right, simply include it within a column (two-column layouts are discussed in more detail below). For example:

There are a few special rules regarding how images within presentations are rendered:

  1. When contained within a column, images fill all available space within the column.
  2. When the only content on a slide is an image, then the image will fill all available space on the slide
  3. Standalone images (images that appear in their own paragraph) that appear along with text are limited to 50% of vertical space.

Two Column Layouts

You can create a two-column slide layout by using a markdown horizontal rule (***). For example:

By default the columns are split equally across the slide. If you want to specify that one column gets proportionally more space you can use the left or right field. For example