# Creating a presentation with R

21 Jun 2015

## Slidify

As a LaTeX fan, I started early to write my presentations with the Beamer document class. Unfortunately, the default classes are starting to look rather antique today and lack the possibility to implement a lot of cool stuff, like maps from leaflet and other applications. This is why the search for something different began.

The first alternative I stumbled upon was io2012 slides, an HTML/JavaScript framework for Google I/O 2012. As you may have heard, it's kind of awesome. Another framework that deserves recognition is definitely reveal.js, which has a solid balance between looking sleek but also very modern. While they look like nice solutions they also require decent web development skills to take advantage of them.

R offers two packages to create presentations with HTML/JavaScript frameworks without actually knowing anything about Java or HTML. There is the package slidify from Ramnath Vaidyanathan and there is R presentation, a feature of RStudio. They both function as a wrapper of several libraries which allows you to go from simple R Markdown to HTML presentations.

I decided to go with slidify because it looked more customizable and offered more JavaScript frameworks. During the first "experimentations" the look of the io2012 slides felt quite comfortable to me and so R presentation was no option. If this has changed in the meantime, please e-mail me with your experience or post something in the discussion.

It seems that slidify is becoming a "thing" now, which is why I will restrict myself to show just the basics of the package and refer to some useful links.

But first have a look at an example by frederickf:

## 1. Install and Initialize

As stated out by Ramnath, the author of the package, slidify is still under heavy development. Therefore, we have to install it from github using the devtools package:

... to initialize a presentation. The function will create a directory for the deck, copy necessary scaffolding for the deck (assets and libraries) and open a default R markdown file:

The code between the two sets of three dashes is the YAML front matter (a recursive acronym that stands for "YAML Ain't Markup Language"), which is used to control the underlying layout and initialize the presentation.

The deck can be shared using GitHub, Dropbox or RPubs directly from R.

## 2. Author and Edit

As I pointed out, here just some basics on how to control slidify:

With three dashes we can separate slides. Content can be written in Markdown or plain HTML. R Code can be implemented like this:

• Markdown Basics:

### 2.1 Change the look and feel

To change the look and feel of your presentation the options framework, highlighter and hitheme must be changed. For each of them a variety of options are available:

• Frameworks:
• Highlighters and Hithemes:

A short summary of all of this is shown in Ramnaths video about slidify:

## 3. Generate and Publish

To generate a static HTML file containing the presentation we can just use:

... and have a look with:

Github and Dropbox can be accessed with:

... and:

## 4. Summary

It looks great. It plays nice with shiny and rCharts. It can easily be published on github. There’s a tonne of cool things slidify can do and I am sure I haven't discovered all of them.

Printing to PDF is a challenge, but I have not checked all options yet (like pandoc for example) This is probably the only downside I came across with during the making of my first HTML presentation.

Overall, the combination of Markdown and slidify can create a nice set of slides in a short amount of time. The coding with slidify is very straightforward and feels fresh after using Beamer for a long time. If you use R frequently, slidify helps by bringing together reproducible analysis and a nice presentation of your results.