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.
- Loading branch information
Showing
4 changed files
with
140 additions
and
202 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,118 +1,42 @@ | ||
--- | ||
title: "Review Dashboard" | ||
output: | ||
flexdashboard::flex_dashboard: | ||
orientation: columns | ||
title: "Diamonds distribution dashboard" | ||
output: flexdashboard::flex_dashboard | ||
--- | ||
|
||
```{r include = FALSE} | ||
library(viridis) | ||
```{r setup, include = FALSE} | ||
library(ggplot2) | ||
library(marmap) | ||
library(dplyr) | ||
knitr::opts_chunk$set(fig.width = 5, fig.asp = 1/3) | ||
``` | ||
|
||
# Intro {.sidebar} | ||
|
||
This dashboard covers several topics: | ||
|
||
* The marmap package | ||
* The viridis package | ||
* Miscellaneous material | ||
|
||
# Marmap Package | ||
|
||
## Column 1 | ||
|
||
### Florida | ||
### Carat | ||
|
||
```{r echo = FALSE} | ||
data(florida) | ||
autoplot(florida) | ||
```{r} | ||
ggplot(diamonds, aes(carat)) + geom_histogram(binwidth = 0.1) | ||
``` | ||
|
||
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 | ||
### Cut | ||
|
||
```{r echo = FALSE} | ||
data(hawaii) | ||
autoplot(hawaii) | ||
```{r} | ||
ggplot(diamonds, aes(cut)) + geom_bar() | ||
``` | ||
|
||
### Alaska | ||
### Colour | ||
|
||
```{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")) | ||
```{r} | ||
ggplot(diamonds, aes(color)) + geom_bar() | ||
``` | ||
|
||
## 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} | ||
### The largest diamonds | ||
|
||
### Bash support | ||
|
||
```{bash} | ||
ls *.Rmd | ||
```{r} | ||
diamonds %>% | ||
arrange(desc(carat)) %>% | ||
head(100) %>% | ||
select(carat, cut, color, price) %>% | ||
DT::datatable() | ||
``` | ||
|
||
*** | ||
|
||
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. |
Oops, something went wrong.