forked from hadley/r4ds
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates Reproducible research chapter.
- Loading branch information
1 parent
a3a3417
commit 4cf15b5
Showing
86 changed files
with
11,365 additions
and
71 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,22 @@ | ||
--- | ||
title: "Viridis Demo" | ||
output: html_document | ||
--- | ||
|
||
```{r include = FALSE} | ||
library(viridis) | ||
``` | ||
|
||
The code below demonstrates two color palettes in the [viridis](https://github.com/sjmgarnier/viridis) package. Each plot displays a contour map of the Maunga Whau volcano in Auckland, New Zealand. | ||
|
||
## Viridis colors | ||
|
||
```{r} | ||
image(volcano, col = viridis(200)) | ||
``` | ||
|
||
## Magma colors | ||
|
||
```{r} | ||
image(volcano, col = viridis(200, option = "A")) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,118 @@ | ||
--- | ||
title: "Review Dashboard" | ||
output: | ||
flexdashboard::flex_dashboard: | ||
orientation: columns | ||
--- | ||
|
||
```{r include = FALSE} | ||
library(viridis) | ||
library(ggplot2) | ||
library(marmap) | ||
``` | ||
|
||
# Intro {.sidebar} | ||
|
||
This dashboard covers several topics: | ||
|
||
* The marmap package | ||
* The viridis package | ||
* Miscellaneous material | ||
|
||
# Marmap Package | ||
|
||
## Column 1 | ||
|
||
### Florida | ||
|
||
```{r echo = FALSE} | ||
data(florida) | ||
autoplot(florida) | ||
``` | ||
|
||
The [marmap](https://cran.r-project.org/web/packages/marmap/index.html) package provides tools and data for visualizing the ocean floor. Here is an example contour plot of marmap's `florida` dataset. | ||
|
||
## Column 2 | ||
|
||
### Hawaii | ||
|
||
```{r echo = FALSE} | ||
data(hawaii) | ||
autoplot(hawaii) | ||
``` | ||
|
||
### Alaska | ||
|
||
```{r echo = FALSE} | ||
data(aleutians) | ||
autoplot(aleutians) | ||
``` | ||
|
||
|
||
# Viridis Package | ||
|
||
## Column 1 | ||
|
||
### Viridis colors | ||
|
||
```{r fig.cap="Maunga Whao, Auckland, NZ"} | ||
image(volcano, col = viridis(200)) | ||
``` | ||
|
||
### Magma colors | ||
|
||
```{r fig.cap="Maunga Whao, Auckland, NZ"} | ||
image(volcano, col = viridis(200, option = "A")) | ||
``` | ||
|
||
## Column 2 | ||
|
||
### Inferno colors | ||
|
||
```{r fig.cap="Maunga Whao, Auckland, NZ"} | ||
image(volcano, col = viridis(200, option = "B")) | ||
``` | ||
|
||
### Plasma colors | ||
|
||
```{r fig.cap="Maunga Whao, Auckland, NZ"} | ||
image(volcano, col = viridis(200, option = "C")) | ||
``` | ||
|
||
# Miscellaneous | ||
|
||
## Column 1 {data-width=300} | ||
|
||
### Bash support | ||
|
||
```{bash} | ||
ls *.Rmd | ||
``` | ||
|
||
*** | ||
|
||
This chunk executes bash code. | ||
|
||
### Python support | ||
|
||
```{python} | ||
x = 'hello, python world!' | ||
print(x.split(' ')) | ||
``` | ||
|
||
*** | ||
|
||
This chunk executes python code. | ||
|
||
## Column 2 {data-width=700} | ||
|
||
### Tables with Kable | ||
|
||
```{r echo = FALSE, results = 'asis'} | ||
library(knitr) | ||
kable(mtcars[1:5, ], caption = "A knitr kable.") | ||
``` | ||
|
||
*** | ||
|
||
It is very easy to make tables with knitr's `kable` function. |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,22 @@ | ||
--- | ||
title: "Viridis Demo" | ||
output: html_document | ||
--- | ||
|
||
```{r include = FALSE} | ||
library(viridis) | ||
``` | ||
|
||
The code below demonstrates two color palettes in the [viridis](https://github.com/sjmgarnier/viridis) package. Each plot displays a contour map of the Maunga Whau volcano in Auckland, New Zealand. | ||
|
||
## Viridis colors | ||
|
||
```{r} | ||
image(volcano, col = viridis(200)) | ||
``` | ||
|
||
## Magma colors | ||
|
||
```{r} | ||
image(volcano, col = viridis(200, option = "A")) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,21 @@ | ||
--- | ||
title: "More colors" | ||
output: html_document | ||
--- | ||
|
||
```{r include = FALSE} | ||
# colorFunc <- "heat.colors" | ||
colorFunc <- "terrain.colors" | ||
# colorFunc <- "topo.colors" | ||
# colorFunc <- "cm.colors" | ||
# colorFunc <- "rainbow" | ||
``` | ||
|
||
Base R comes with many functions for generating colors. The code below demonstrates the `r colorFunc` function. | ||
|
||
## `r colorFunc` | ||
|
||
```{r fig.cap = "The Maunga Whau volcano.", echo = FALSE} | ||
image(volcano, col = get(colorFunc)(200)) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,10 @@ | ||
name: "my-website" | ||
navbar: | ||
title: "My Website" | ||
left: | ||
- text: "Home" | ||
href: index.html | ||
- text: "Viridis Colors" | ||
href: 1-example.html | ||
- text: "Terrain Colors" | ||
href: 3-inline.html |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.