Skip to content

Commit

Permalink
Starting to work on formats chapter
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Aug 22, 2016
1 parent 5de327e commit 0875f55
Show file tree
Hide file tree
Showing 4 changed files with 140 additions and 202 deletions.
118 changes: 21 additions & 97 deletions rmarkdown-demos/11-dashboard.Rmd
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.
Loading

0 comments on commit 0875f55

Please sign in to comment.