Updated 2015 January 14th
I'll be giving a talk on analysing CAGE data using R in an upcoming workshop held at our institute early next year. I thought it would be a good time to check out slidify, which is an R package that can create HTML slides from R Markdown, since I'm planning on making slides using R. I will be using RStudio to convert R Markdown (i.e. knit) into a HTML document.
To those unfamiliar with R Markdown, here's a quick demo; click the following in RStudio:
File -> New File -> R Markdown
then when prompted, change the title and author fields to your liking (I used "Default R Markdown" and "Dave Tang"), select the HTML bullet, and then click OK. You should see the following in your source pane:
title: "Default R Markdown"
author: "Dave Tang"
date: "12 December 2014"
output: html_document
---
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r}
summary(cars)
```
You can also embed plots, for example:
```{r, echo=FALSE}
plot(cars)
```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
This R Markdown format can be converted into HTML and published online; just click the following:
Knit HTML -> Publish -> Publish
Here's the link to the HTML document for the R Markdown we have above:
http://rpubs.com/davetang/47785
Notice how the R code is displayed followed with the output of running that code snippet.
Getting started with slidify
Now to make slides using R; firstly, install the slidify package:
install.packages('devtools')
library(devtools)
install_github("ramnathv/slidify")
install_github("ramnathv/slidifyLibraries")
The author() function, creates a directory (that's also initiated as a git repository) that stores all the files created by the slidify package. It'll create the directory in your current working directory
library(slidify)
author("slidify_test")
Here's the R Markdown for three slides (the updated R Markdown code for the talk can be viewed here):
title : Analysing CAGE data using R
subtitle : MODHEP workshop
author : Dave Tang
job : PhD candidate
framework : io2012 # {io2012, html5slides, shower, dzslides, ...}
highlighter : highlight.js # {highlight.js, prettify, highlight}
hitheme : tomorrow #
widgets : [] # {mathjax, quiz, bootstrap}
mode : selfcontained # {standalone, draft}
knit : slidify::knit2slides
github:
user: davetang
repo: cage_r
---
## Welcome!
> 1. My name is Dave
> 2. I'm a PhD student here at RIKEN
> 3. I'm here to (hopefully) show you how to analyse CAGE data using R
---
## CAGEr
We will be using the CAGEr package, so we need to install it first. While we are at it, let's download some FANTOM3 and FANTOM4 CAGE data:
```
source("http://bioconductor.org/biocLite.R")
biocLite("CAGEr")
biocLite("FANTOM3and4CAGE")
```
Loading the libraries
```{r}
library(CAGEr)
library(FANTOM3and4CAGE)
```
---
## Getting started
```{r}
data(FANTOMhumanSamples)
head(FANTOMhumanSamples)
```
---
## Random heatmap
```{r}
set.seed(31)
image(matrix(rnorm(100),nrow=10))
```
After making a new GitHub repository, I can publish the slides by running:
publish('cage_r', 'davetang')
Finally, here are the slides (I will be of course including more material) made by slidify from the R Markdown above and hosted on GitHub:
https://davetang.github.io/cage_r
Pretty nifty eh?
You can also check out this short presentation on slidify by Brian Caffo.
And this blog post on slidify by Ben Moore.

This work is licensed under a Creative Commons
Attribution 4.0 International License.