r4ds/rmarkdown/dashboard.Rmd

43 lines
595 B
Plaintext
Raw Normal View History

2016-08-19 01:40:09 +08:00
---
2016-08-23 06:28:29 +08:00
title: "Diamonds distribution dashboard"
output: flexdashboard::flex_dashboard
2016-08-19 01:40:09 +08:00
---
2016-08-23 06:28:29 +08:00
```{r setup, include = FALSE}
2016-08-19 01:40:09 +08:00
library(ggplot2)
2016-08-23 06:28:29 +08:00
library(dplyr)
knitr::opts_chunk$set(fig.width = 5, fig.asp = 1/3)
2016-08-19 01:40:09 +08:00
```
## Column 1
2016-08-23 06:28:29 +08:00
### Carat
2016-08-19 01:40:09 +08:00
2016-08-23 06:28:29 +08:00
```{r}
ggplot(diamonds, aes(carat)) + geom_histogram(binwidth = 0.1)
2016-08-19 01:40:09 +08:00
```
2016-08-23 06:28:29 +08:00
### Cut
2016-08-19 01:40:09 +08:00
2016-08-23 06:28:29 +08:00
```{r}
ggplot(diamonds, aes(cut)) + geom_bar()
2016-08-19 01:40:09 +08:00
```
2016-08-23 06:28:29 +08:00
### Colour
2016-08-19 01:40:09 +08:00
2016-08-23 06:28:29 +08:00
```{r}
ggplot(diamonds, aes(color)) + geom_bar()
2016-08-19 01:40:09 +08:00
```
## Column 2
2016-08-23 06:28:29 +08:00
### The largest diamonds
2016-08-19 01:40:09 +08:00
2016-08-23 06:28:29 +08:00
```{r}
2022-02-24 03:15:52 +08:00
diamonds |>
arrange(desc(carat)) |>
head(100) |>
select(carat, cut, color, price) |>
2016-08-23 06:28:29 +08:00
DT::datatable()
2016-08-19 01:40:09 +08:00
```