Slidify helps create, customize and share, elegant, dynamic and interactive HTML5 documents using R Markdown.
Ramnath Vaidyanathan
McGill University
Slidify helps create, customize and share, elegant, dynamic and interactive HTML5 documents using R Markdown.
Slidify is not on CRAN and needs to be installed from github
using the devtools
package. I would recommend installing the dev
version of the package.
# install.packages('devtools')
pkgs <- c("slidify", "slidifyLibraries", "rCharts")
install_github(pkgs, 'ramnathv', ref = 'dev')
NOTE: While the installation process from github
is relatively painless for Mac/Linux/Ubuntu users, it can make Windows users jump through hoops. For those of you on Windows that hit a bottleneck, here is an excellent blog post that takes you through an alternate installation process that has been reported to work well.
Slidify helps create, customize and share, elegant, dynamic and interactive HTML5 documents using R Markdown.
author("myDeck")
slidify("index.Rmd")
browseURL("index.html")
publish("myDeck", "ramnathv")
The easiest way to get started is by using the author
function to set up a scaffold for your slide deck. This will do the following
author("myDeck")
---
title :
subtitle :
author :
job :
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
---
## Read-And-Delete
1. Edit YAML front matter
2. Write using R Markdown
3. Use an empty line followed by three dashes to separate slides!
--- .class #id
## Slide 2
slidify("index.Rmd")
browseURL("index.html")
Slidify helps create, customize and share, elegant, dynamic and interactive HTML5 documents using R Markdown.
Slidify is highly modular and attempts to achieve clean separation of content from view and behavior. There are several ways to customize a document.
We will look at customization in more detail later.
Slidify helps create, customize and share, elegant, dynamic and interactive HTML5 documents using R Markdown.
Share your document easily on
The default option is to publish to github.
publish('myDeck', 'ramnathv')
In order to use this option, you need to
git
.github
account.github
.Alternately, you can also use the github GUI client to publish. This screencast provides details.
You can share your deck using Dropbox, by copying it to your Public folder.
publish('myDeck', host = "dropbox")
You can also drag-and-drop your slide folder to your Public Dropbox folder and get a link to index.html
. Press p
to see a screenshot of how to do this.
RPubs is a service provided by RStudio to share RMarkdown documents. Here are the steps to share on RPubs.
mode
to standalone
in index.Rmd
.slidify('index.Rmd')
. Slidify helps create, customize and share, elegant, dynamic and interactive HTML5 documents using R Markdown.
Dynamic content implies that plots, tables and other results in the deck can be dynamically generated using code snippets. Slidify uses the knitr
package to accomplish this.
## A Simple Plot
```{r simple-plot, fig.height = 6, fig.align = 'center', message = F}
require(ggplot2)
qplot(wt, mpg, data = mtcars)
```
---
## MotionPlot
```{r results = 'asis', commment = NA, message = F, echo = F}
require(googleVis)
M1 <- gvisMotionChart(Fruits, idvar="Fruit", timevar="Year")
print(M1, tag = 'chart')
```
require(ggplot2)
qplot(wt, mpg, data = mtcars)
Slidify helps create, customize and share, elegant, dynamic and interactive HTML5 documents using R Markdown.
Slidify uses widgets
to add interactive content to slides.
---
title: Interactive Quiz
widgets: [bootstrap, quiz]
--- &radio
## Question 1
What is 1 + 1?
1. 1
2. _2_
3. 3
*** .hint
This is a hint
*** .explanation
This is an explanation
What is 1 + 1?
This is a hint
This is an explanation
require(rCharts)
haireye = as.data.frame(HairEyeColor)
n1 <- nPlot(Freq ~ Hair,
group = 'Eye',
data = subset(haireye, Sex == 'Male'),
type = 'multiBarChart'
)
n1$show('inline')