```{r setup, include=FALSE} if (!require("knitr")) { install.packages("knitr") library(knitr) } if (!require("pander")) { install.packages("pander") library(pander) } if (!require("tidyverse")) { install.packages("tidyverse") library(tidyverse) } if (!require("ggplot2")) { install.packages("ggplot2") library(ggplot2) } if (!require("plotly")) { install.packages("plotly") library(plotly) } knitr::opts_chunk$set(echo = FALSE) ``` # Getting Started with Slidy Presentation
- Default template: simple and flexible. - Suggested modified template: YAML header
``` --- title: '
Slidy Presentation
' author: "Cheng Peng" date: '

West Chester University' output: slidy_presentation: font_adjustment: +1 footer: 'Slidy presentation created using RMarkdown' widescreen: yes self_contained: true --- ```
- CSS file (feel free to modify) - `(level 1 Header: #)` starts title slides with no accompanying text underneath. - `(level 2 Header: ##)` starts new slides with additional content underneath. - `Markdown tag ---`: an alternative to `##`.
# Bullet Points
- level 1 bullet - level 2 bullet - level 2 bullet - level 1 bullet - level 1 bullet - level 2 bullet - level 3 bullet
# Two-column slide ## HTML Table
Left-column Right-column
left cell contents right cell contents
## Markdown Table
| Left-column | Right-column | |:------------------:|:--------------------:| | left cell contents| $x^2+y^2 = r^2$ |
# Slide with R Kable Output
```{r} knitr::kable(summary(cars)) ```
# Default Output Table
```{r comment = NA} summary(cars) ```
# Slide with Plot ```{r pressure, fig.align='center', fig.width=4, fig.height=4} par(bg="#8fb0c4") plot(pressure) ``` # Include External Images
- using software remove background first (e.g., ) - embedding transparent image to the slide to match the background color. - see the example below
# Embedding Opened PDF Documents

Unable to display PDF file. Download instead.

# Overlay Density Curves ```{r echo=FALSE} # define three densities sepal.len.setosa <- iris[which(iris$Species == "setosa"),] setosa <- density(sepal.len.setosa$Sepal.Length) sepal.len.versicolor <- iris[which(iris$Species == "versicolor"),] versicolor <- density(sepal.len.versicolor$Sepal.Length) sepal.len.virginica <- iris[which(iris$Species == "virginica"),] virginica <- density(sepal.len.virginica$Sepal.Length) # plot density curves fig <- plot_ly(x = ~virginica$x, y = ~virginica$y, type = 'scatter', mode = 'lines', name = 'virginica', fill = 'tozeroy') %>% # adding more density curves add_trace(x = ~versicolor$x, y = ~versicolor$y, name = 'versicolor', fill = 'tozeroy') %>% add_trace(x = ~setosa$x, y = ~setosa$y, name = 'setosa', fill = 'tozeroy') %>% layout(xaxis = list(title = 'Sepal Length'), yaxis = list(title = 'Density')) fig ``` # Searchable Data Table ```{r eval=requireNamespace("DT", quietly=TRUE)} DT::datatable(head(mtcars), fillContainer = FALSE, options = list(pageLength = 4)) ```