Contenido
1. Authoring R Markdown Reports ........................................................................ 2
1.1. The R Markdown Interface ......................................................................... 2
1.2. Explore R Markdown .................................................................................. 3
1.3. Prepare your workspace for preliminary analysis ....................................... 4
1.4. Styling narrative sections ........................................................................... 7
1.5. Lists ............................................................................................................ 8
1.6. LaTeX Equations ........................................................................................ 9
2. Embedding R Code ........................................................................................ 10
2.1. R Code Chunks ........................................................................................ 10
2.2. Customize R code chunks ........................................................................ 11
2.3. Inline R Code ........................................................................................... 14
2.4. Labeling and Reusing code chunks ......................................................... 17
3. Compiling Reports .......................................................................................... 18
3.1. Alternative output formats ........................................................................ 18
3.2. Creating Slideshows................................................................................. 19
3.3. Specify knitr and pandoc options ............................................................. 21
3.4. Recurring to a CSS File to manage Style ................................................. 23
3.5. Interactive Reports with Shiny .................................................................. 24
3.6. Interactive ggvis graphics ........................................................................ 26
Page 1
Reporting with R Markdown DataCamp
When you click "Knit HTML", DataCamp will compile your R Markdown
document and display the finished, formatted results in a new pane.
To give you a taste of the things you'll learn in this course, we've prepared two
documents in the editor on the right:
INSTRUCTIONS
Click the "Knit HTML" button to see the compiled version of your sample
code.
MI DOCUMENT.RMD
---
title: "Hello R Markdown"
output:
html_document:
css: faded.css
---
## Data
The `atmos` data set resides in the `nasaweather` package of the *R* programming language.
It contains a collection of atmospheric variables measured between 1995 and 2000 on
a grid of 576 coordinates in the western hemisphere. The data set comes from the
[2006 ASA Data Expo](http://stat-computing.org/dataexpo/2006/).
* **temp** - The mean monthly air temperature near the surface of the Earth (measured in
kelvins (*K*))
* **pressure** - The mean monthly air pressure at the surface of the Earth (measured in
millibars (*mb*))
Page 2
Reporting with R Markdown DataCamp
* **ozone** - The mean monthly abundance of atmospheric ozone (measured in Dobson units
(*DU*))
You can convert the temperature unit from Kelvin to Celsius with the formula
And you can convert the result to Fahrenheit with the formula
FADED.CSS
h1{
color: white;
padding: 10px;
background-color: #3399ff
}
ul {
list-style-type: square;
}
.MathJax_Display {
padding: 0.5em;
background-color: #eaeff3
}
RESULT: https://s3.amazonaws.com/markdown-uploads.datacamp.com/hojbkhifbyqxpxolah.html
Click the 'Knit HTML' button and compare the document to its compiled form.
Then:
Page 3
Reporting with R Markdown DataCamp
---
title: "Hello World"
author: "Miguel Prada"
date: "January 1, 2015"
output: html_document
---
This is my first 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
<http://rmarkdown.rstudio.com>.
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(mtcars)
```
```{r, echo=FALSE}
plot(mtcars)
```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of
the R code that generated the plot.
RESULT: https://s3.amazonaws.com/markdown-uploads.datacamp.com/rjjplyctzjsvomnwhgfa.html
We'll also use the dplyr package to manipulate our data and
the ggvis package to visualize it.
For the next set of exercises, you will use the traditional DataCamp interface:
you have an editor where you can write and submit R code, as well as a
console where you can experiment with R code without doing a formal
submission.
Page 4
Reporting with R Markdown DataCamp
After submitting the correct code, open the help page for the atmos data
set by executing ?atmos in the console. Before proceeding to the next
exercise, read the help page to familiarize yourself with the data.
We will use some of the data in atmos to explore the relationship between
ozone and temperature. But before we do, let's transform the data into a more
useful form.
The sample code uses dplyr functions to aggregate the data. It computes the
mean value of temp, pressure, ozone, cloudlow, cloudmid, and cloudhigh for
each latitude/longitude grid point.
Don't get confused by the pipe operator ( %>% ) from the magrittr package that
is used often in combination with dplyr verbs. It is used to chain your code in
case there are several operations you want to do without the need to save
intermediate results.
Set the year variable to 1995. This will cause the code to retain just
observations from the year 1995.
At the end of the sample code, add a command to print the
resulting means data frame and examine its output.
Page 5
Reporting with R Markdown DataCamp
The sample code on the right uses ggvis functions to visualize the data. It
displays a plot of pressure vs. ozone.
We'll use ggvis to create several graphs for our R Markdown reports.
Run the code and take a look at the graph that it makes. See how
straightforward it is to plot the data from the previous exercise?
Change the code to plot the temp variable vs the ozone variable, both in
the means data set. We will write an R Markdown report that analyzes
the relationship between temp and ozone.
# The nasaweather, dplyr and ggvis packages are loaded in the workspace.
# Change the code to plot the temp variable vs the ozone variable
means %>%
ggvis(x = ~temp, y = ~ozone) %>%
layer_points()
We've now loaded data, cleaned it, and visualized it. Our analysis will have
one more component: a model.
Page 6
Reporting with R Markdown DataCamp
The code on the right creates a linear model that predicts ozone based
on pressure and cloudlow; all three are variables of the means data frame you
created earlier.
You can learn more about building models with R in DataCamp's Introduction
to Statistics course.
*italics*
**bold**
`code`
You can turn a word into a link by surrounding it in hard brackets and then
placing the link behind it in parentheses, like this:
[RStudio](www.rstudio.com)
To create titles and headers, use leading hastags. The number of hashtags
determines the header's level:
Page 7
Reporting with R Markdown DataCamp
The paragraph to the right describes the data that we'll use in our report.
Turn the line that begins with "Data" into a second level header.
The paragraph to the right describes the data that you'll use in your report. Try
rendering it both before and after you make the changes below.
## Data
The `atmos` data set resides in the `nasaweather` package of the *R* programming language.
It contains a collection of atmospheric variables measured between 1995 and 2000 on
a grid of 576 coordinates in the western hemisphere. The data set comes from the
[2006 ASA Data Expo](http://stat-computing.org/dataexpo/2006/).
RESULT: https://s3.amazonaws.com/markdown-uploads.datacamp.com/iefsfcpdhhukkstivyv.html
1.5. Lists
To make a bulleted list in Markdown, place each item on a new line after an
asterisk and a space, like this:
* item 1
* item 2
* item 3
You can make an ordered list by placing each item on a new line after a
number followed by a period followed by a space, like this
1. item 1
2. item 2
3. item 3
In each case, you need to place a blank line between the list and any
paragraphs that come before it.
Page 8
Reporting with R Markdown DataCamp
Turn the text into a bulleted list with three bullets. Temp, pressure, and ozone
should each get their own entry.
Make temp, pressure, and ozone bold at the start of each entry.
* **temp** - The mean monthly air temperature near the surface of the Earth (measured in
kelvins (*K*))
* **pressure** - The mean monthly air pressure at the surface of the Earth (measured in
millibars (*mb*))
* **ozone** - The mean monthly abundance of atmospheric ozone (measured in Dobson units
(*DU*))
RESULT: https://s3.amazonaws.com/markdown-uploads.datacamp.com/vcrcykctrbswsxrnteyv.html
$$1 + 1 = 2$$
To embed an equation inline, surround it with a single pair of dollar signs, like
this: $1 + 1 = 2$.
You can use all of the standard latex math symbolsto create attractive
equations.
The text on the right contains a formula that converts degrees Celsius to degrees
Fahrenheit. Where the comment is, write another formula that converts degrees Kelvin to
degrees Celsius. You can convert any temperature in degrees Kelvin to a temperature in
degrees Celsius by subtracting 273.15 from it. Do not capitalize Kelvin or Celsius when
writing the formula. Then render your results to see the final format.
You can convert the temperature unit from Kelvin to Celsius with the formula
And you can convert the result to Fahrenheit with the formula
RESULT: https://s3.amazonaws.com/markdown-uploads.datacamp.com/tohurdhnfpwlaquefcr.html
Page 9
Reporting with R Markdown DataCamp
2. Embedding R Code
2.1. R Code Chunks
You can embed R code into your R Markdown report with the knitr syntax. To
do this, surround your code with two lines: one that contains ```{r} and one
that contains ``` . The result is a code chunk that looks like this:
```{r}
# some code
```
When you render the report, R will execute the code. If the code returns any
results, R will add them to your report.
The first file in the editor pane on the right contains the next section of your R
Markdown report. This section will explain how you cleaned your data. The
second file (my_code.R) on the right is an R Script that contains the actual
code that we used to clean the data. Use the knitr syntax to embed this code
into the .Rmd file.
## Cleaning
For the remainder of the report, we will look only at data from the year 1995. We aggregate
our data by location, using the *R* code below.
```{r}
library(nasaweather)
library(dplyr)
RESULT: https://s3.amazonaws.com/markdown-uploads.datacamp.com/shdjftrnujkaikxqreym.html
Good job! Notice that this code does not display any results. It simply
saves means so we can use it later. Did you notice that we
included library(nasaweather) and library(dplyr) to be rerun in the last
exercise? Each R Markdown document is given a fresh, empty R session to run
its code chunks in. This means that you will need to define any R objects that this
Page 10
Reporting with R Markdown DataCamp
document uses - and load any packages that it uses - inside the same R
Markdown document. The document won't have access to the objects that exist in
your current R session.
Arrange for the new code chunk to ignore any messages that are
generated when loading the packages.
## Cleaning
For the remainder of the report, we will look only at data from the year 1995. We
aggregate our data by location, using the *R* code below.
```{r message=FALSE}
library(nasaweather)
library(dplyr)
library(ggvis)
Page 11
Reporting with R Markdown DataCamp
```
```{r}
year <- 1995
Nice job! Notice that splitting your code in different chunks does not change
anything about the availability of the results. Although the library() functions
have been executed in another chunk, the packages are still available in the next
chunk.
Three of the most popular chunk options are echo , eval and results.
If echo = FALSE, R Markdown will not display the code in the final document
(but it will still run the code and display its results unless told otherwise).
If eval = FALSE, R Markdown will not run the code or include its results, (but it
will still display the code unless told otherwise).
If results = 'hide' , R Markdown will not display the results of the code (but it
will still run the code and display the code itself unless told otherwise).
The R Markdown file to the right contains a complete report with two figures. It
is common to display figures without the code that generates them (the code is
a distraction). Modify each code chunk that generates a graph so that it does
not display the code that makes the graph. Notice how the document controls
the size of the figures with the fig.heightand fig.width arguments.
## Data
The `atmos` data set resides in the `nasaweather` package of the *R* programming language.
It contains a collection of atmospheric variables measured between 1995 and 2000 on
a grid of 576 coordinates in the western hemisphere. The data set comes from the
[2006 ASA Data Expo](http://stat-computing.org/dataexpo/2006/).
* **temp** - The mean monthly air temperature near the surface of the Earth (measured in
kelvins (*K*))
* **pressure** - The mean monthly air pressure at the surface of the Earth (measured in
millibars (*mb*))
Page 12
Reporting with R Markdown DataCamp
* **ozone** - The mean monthly abundance of atmospheric ozone (measured in Dobson units
(*DU*))
You can convert the temperature unit from Kelvin to Celsius with the formula
And you can convert the result to Fahrenheit with the formula
## Cleaning
For the remainder of the report, we will look only at data from the year 1995. We aggregate
our data by location, using the *R* code below.
```{r}
year <- 1995
means <- atmos %>%
filter(year == year) %>%
group_by(long, lat) %>%
summarize(temp = mean(temp, na.rm = TRUE),
pressure = mean(pressure, na.rm = TRUE),
ozone = mean(ozone, na.rm = TRUE),
cloudlow = mean(cloudlow, na.rm = TRUE),
cloudmid = mean(cloudmid, na.rm = TRUE),
cloudhigh = mean(cloudhigh, na.rm = TRUE)) %>%
ungroup()
```
Is the relationship between ozone and temperature useful for understanding fluctuations in
ozone? A scatterplot of the variables shows a strong, but unusual relationship.
We suspect that group level effects are caused by environmental conditions that vary by
locale. To test this idea, we sort each data point into one of four geographic
regions:
```{r}
means$locale <- "north america"
means$locale[means$lat < 10] <- "south pacific"
means$locale[means$long > -80 & means$lat < 10] <- "south america"
means$locale[means$long > -80 & means$lat > 10] <- "north atlantic"
```
### Model
Page 13
Reporting with R Markdown DataCamp
We suggest that ozone is highly correlated with temperature, but that a different
relationship exists for each geographic region. We capture this relationship with
a second order linear model of the form
```{r}
lm(ozone ~ temp + locale + temp:locale, data = means)
```
### Diagnostics
An anova test suggests that both locale and the interaction effect of locale and temperature
are useful for predicting ozone (i.e., the p-value that compares the full model to
the reduced models is statistically significant).
```{r}
mod <- lm(ozone ~ temp, data = means)
mod2 <- lm(ozone ~ temp + locale, data = means)
mod3 <- lm(ozone ~ temp + locale + temp:locale, data = means)
For example, the line below uses embedded R code to create a complete
sentence:
When you render the document the result will appear as:
Page 14
Reporting with R Markdown DataCamp
The report to the right has been reorganized to make it more automatable.
Render the document and notice how everything updates to use the
new year's worth of data. Even the sentences in lines 31 and 52 update
to reflect the new year.
---
output: html_document
---
## Data
The `atmos` data set resides in the `nasaweather` package of the *R* programming language.
It contains a collection of atmospheric variables measured between 1995 and 2000 on
a grid of 576 coordinates in the western hemisphere. The data set comes from the
[2006 ASA Data Expo](http://stat-computing.org/dataexpo/2006/).
* **temp** - The mean monthly air temperature near the surface of the Earth (measured in
kelvins (*K*))
* **pressure** - The mean monthly air pressure at the surface of the Earth (measured in
millibars (*mb*))
* **ozone** - The mean monthly abundance of atmospheric ozone (measured in Dobson units
(*DU*))
You can convert the temperature unit from Kelvin to Celsius with the formula
And you can convert the result to Fahrenheit with the formula
## Cleaning
For the remainder of the report, we will look only at data from the year `r year`. We
aggregate our data by location, using the *R* code below.
Page 15
Reporting with R Markdown DataCamp
```{r}
means <- atmos %>%
filter(year == year) %>%
group_by(long, lat) %>%
summarize(temp = mean(temp, na.rm = TRUE),
pressure = mean(pressure, na.rm = TRUE),
ozone = mean(ozone, na.rm = TRUE),
cloudlow = mean(cloudlow, na.rm = TRUE),
cloudmid = mean(cloudmid, na.rm = TRUE),
cloudhigh = mean(cloudhigh, na.rm = TRUE)) %>%
ungroup()
```
Is the relationship between ozone and temperature useful for understanding fluctuations in
ozone? A scatterplot of the variables shows a strong, but unusual relationship.
We suspect that group level effects are caused by environmental conditions that vary by
locale. To test this idea, we sort each data point into one of four geographic
regions:
```{r}
means$locale <- "north america"
means$locale[means$lat < 10] <- "south pacific"
means$locale[means$long > -80 & means$lat < 10] <- "south america"
means$locale[means$long > -80 & means$lat > 10] <- "north atlantic"
```
### Model
We suggest that ozone is highly correlated with temperature, but that a different
relationship exists for each geographic region. We capture this relationship with
a second order linear model of the form
```{r}
lm(ozone ~ temp + locale + temp:locale, data = means)
```
Page 16
Reporting with R Markdown DataCamp
### Diagnostics
An anova test suggests that both locale and the interaction effect of locale and temperature
are useful for predicting ozone (i.e., the p-value that compares the full model to
the reduced models is statistically significant).
```{r}
mod <- lm(ozone ~ temp, data = means)
mod2 <- lm(ozone ~ temp + locale, data = means)
mod3 <- lm(ozone ~ temp + locale + temp:locale, data = means)
2 + 2
What purpose do these labels serve? knitr provides the option ref.label to
refer to previously defined and labeled code chunks. If used
correctly, knitr will copy the code of the chunk you referred to and repeat it in
the current code chunk. This feature enables you to separate R code and R
output in the output document, without code duplication.
## [1] 4
Notice that the echo option was explicitly set to FALSE, suppressing the R code
that generated the output.
Page 17
Reporting with R Markdown DataCamp
In the sample code on the right, you see a rather large code chunk that
contains R code to load packages dplyr and ggvis and functions to create a
ggvis graph
Separate the code chunks into two: one for the library() calls, one for
the ggvis and dplyrfunctions.
Edit the first chunk's header so no messages are shown in the output
document.
Edit the first chunk's header so output is hidden; give this code chunk
the label chained .
Move the sentence "The ggvis plot gives us a nice visualization of
the mtcars data set:" after the second chunk.
Add a third chunk at the end containing no code, showing the output of
the second chunk, without the echoing code that generated it. Use
the ref.label option.
Have you ever wondered whether there is a clear correlation between the gas consumption of
a car and its weight?
To answer this question, we first have to load the `dplyr` and `ggvis` packages.
The `ggvis` plot gives us a nice visualization of the `mtcars` data set:
RESULT: https://s3.amazonaws.com/markdown-uploads.datacamp.com/jlmbrjplrrqdotohdrke.html
3. Compiling Reports
3.1. Alternative output formats
You can render the same R Markdown file into several different formats. There
are two ways to change a file's output format.
First, you can click the triangle icon next to "Knit HTML" at the bottom of the
pane that displays your R Markdown file. This will open a drop down menu that
gives you the choice of rendering as an HTML document or a pdf document.
Page 18
Reporting with R Markdown DataCamp
Second, you can change the output field in the YAML block at the top of your
document. For example, this YAML block will create an HTML file:
---
output: html_document
---
---
output: pdf_document
---
---
output: word_document
---
---
output: md_document
---
---
title: "Cloud Cover"
author: "Anonymous"
date: "December 2, 2014"
output: pdf_document
---
Good work! Rendering R Markdown files in the RStudio IDE works the same way.
But what if you are using R in a terminal window? You can run the
command rmarkdown::render(<file path>) to render any .Rmd file with R.
---
output: beamer_presentation
Page 19
Reporting with R Markdown DataCamp
---
---
output: ioslides_presentation
---
---
output: slidy_presentation
---
R Markdown will start a new slide at each first or second level header in your
document. You can insert additional slide breaks with Markdown's horizontal
rule syntax:
***
Everywhere you add these three asterisks in your text, pandoc will create a
new slide.
Change the output type of the cloud report to a slidy HTML slideshow.
Insert a horizontal rule before "Some of the variables" and "You can
convert" to create additional slide breaks.
---
title: "Cloud Cover"
author: "Anonymous"
date: "December 2, 2014"
output: slidy_presentation
---
## Data
The `atmos` data set resides in the `nasaweather` package of the *R* programming language.
It contains a collection of atmospheric variables measured between 1995 and 2000 on
a grid of 576 coordinates in the western hemisphere. The data set comes from the
[2006 ASA Data Expo](http://stat-computing.org/dataexpo/2006/).
***
* **cloudlow** - The mean percent of the sky covered by clouds at low altitudes.
* **cloudmid** - The mean percent of the sky covered by clouds at mid-range altitudes.
Page 20
Reporting with R Markdown DataCamp
* **cloudhigh** - The mean percent of the sky covered by clouds at high altitudes.
***
You can convert the temperature unit from Kelvin to Celsius with the formula
And you can convert the result to Fahrenheit with the formula
## Cleaning
For the remainder of the report, we will look only at data from the year `r year`. We
aggregate our data by location, using the *R* code below.
```{r}
means <- atmos %>%
filter(year == year) %>%
group_by(long, lat) %>%
summarize(temp = mean(temp, na.rm = TRUE),
pressure = mean(pressure, na.rm = TRUE),
ozone = mean(ozone, na.rm = TRUE),
cloudlow = mean(cloudlow, na.rm = TRUE),
cloudmid = mean(cloudmid, na.rm = TRUE),
cloudhigh = mean(cloudhigh, na.rm = TRUE)) %>%
ungroup()
Great job! When you render R Markdown documents on your own computer, R
Markdown will save a copy of the file (in the output file type) on your machine. It
will appear in the same folder that the .Rmd file lives in. Feel free to experiment
with the other slideshow formats in this exercise!
Page 21
Reporting with R Markdown DataCamp
For example, the YAML header below overwrites the default code highlight
style of the pdf_documenttemplate to create a document that uses the zenburn
style:
---
title: "Demo"
output:
pdf_document:
highlight: zenburn
---
The YAML header below overwrites the default bootstrap CSS theme of
the html_document template.
---
title: "Demo"
output:
html_document:
theme: spacelab
---
Pay close attention to the indentation of the options inside the YAML header; if
you do not do this correctly, pandoc will not correctly understand your
specifications. As an example, notice the difference between only specifying
the output document to be HTML:
---
output: html_document
---
---
output:
html_document:
theme: spacelab
---
You can learn more about popular options to overwrite in the R Markdown
Reference Guide.
Move the html_document header element to its own line, and indent it to
be a subelement of output.
Page 22
Reporting with R Markdown DataCamp
---
title: "Ozone"
author: "Anonymous"
date: "January 1, 2015"
output:
html_document:
toc: true
number_sections: true
---
RESULT: https://s3.amazonaws.com/markdown-
uploads.datacamp.com/fvxngrgrhplxakfnwtbx.html#ozone-and-temperature
You are getting the hang of it! Notice that the numbering of the table of contents
contains a zero since no first level headers were defined. Each document template
has its own set of options to overwrite. Check out the R Markdown Reference
Guide for a full, but concise description of the possibilities.
But what if you want to customize your CSS in more specific ways? You can
do this by writing a .css file for your report and saving it in the same directory
as the .Rmd file. To have your report use the CSS, set the css option
of html_document to the file name, like this
---
title: "Demo"
output:
html_document:
css: styles.css
---
The faded.css file to the right contains some example CSS that will change
the appearance of your report.
Page 23
Reporting with R Markdown DataCamp
R MARKDOWN FILE:
---
title: "Ozone"
author: "Anonymous"
date: "January 1, 2015"
output:
html_document:
css: faded.css
---
.
.
.
FADED.CSS:
h1{
color: white;
padding: 10px;
background-color: #3399ff
}
ul {
list-style-type: square;
}
.MathJax_Display {
padding: 0.5em;
background-color: #eaeff3
}
RESULT: https://s3.amazonaws.com/markdown-uploads.datacamp.com/raxcakycbxxuuwiatiz.html
Nice work! R Markdown might be a new way of reporting, but branding R Markdown
reports in a familiar way is straightforward!
Page 24
Reporting with R Markdown DataCamp
---
title: "Shiny Demo"
author: "DataCamp"
output: html_document
runtime: shiny
---
This R Markdown document is made interactive using Shiny. Unlike the more traditional
workflow of creating static reports, you can now create documents that allow your
readers to change the assumptions underlying your analysis and see the results
immediately.
You can embed Shiny inputs and outputs in your document. Outputs are automatically updated
whenever inputs change. This demonstrates how a standard R plot can be made
interactive by wrapping it in the Shiny `renderPlot` function. The `selectInput`
and `sliderInput` functions create the input widgets used to drive the plot.
```{r, echo=FALSE}
inputPanel(
selectInput("n_breaks", label = "Number of bins:",
choices = c(10, 20, 35, 50), selected = 20),
renderPlot({
hist(faithful$eruptions, probability = TRUE, breaks = as.numeric(input$n_breaks),
xlab = "Duration (minutes)", main = "Geyser eruption duration")
## Embedded Application
```{r, echo=FALSE}
shinyAppDir(
system.file("examples/06_tabsets", package = "shiny"),
options = list(
width = "100%", height = 550
)
Page 25
Reporting with R Markdown DataCamp
)
```
Note the use of the `height` parameter to determine how much vertical space the embedded
application should occupy.
You can also use the `shinyApp` function to define an application inline rather then in an
external directory.
In all of R code chunks above the `echo = FALSE` attribute is used. This is to prevent the
R code within the chunk from rendering in the document alongside the Shiny
components.
RESULT: https://multiplexer-
paid.datacamp.com/proxy/relative/2d74f23cf1628855b13a6e30a3472450/ctzoicyjxdjgonye
fdsc/
You do not need to wrap your interactive ggvisplots in a render function. They
are ready to use as is in an R Markdown document.
The .Rmd file to the right contains a ggvis plot that updates as a user moves a
slider.
Render the document; you will see that the rendered document will be
static. The interactive report is hosted at Datacamp's Shiny server.
---
title: "ggvis"
author: "DataCamp"
output: html_document
runtime: shiny
---
ggvis provides a number of ways to enhance plots with interacticity. For example, the
density plot below allows users to set the kernel and bandwidth of the plot.
Page 26
Reporting with R Markdown DataCamp
Page 27