2022-10-22 06:12:48 +08:00
|
|
|
---
|
|
|
|
title: "Diamond sizes"
|
|
|
|
date: 2022-09-12
|
|
|
|
format: html
|
|
|
|
---
|
|
|
|
|
|
|
|
```{r}
|
|
|
|
#| label: setup
|
|
|
|
#| include: false
|
|
|
|
|
|
|
|
library(tidyverse)
|
|
|
|
|
|
|
|
smaller <- diamonds |>
|
|
|
|
filter(carat <= 2.5)
|
|
|
|
```
|
|
|
|
|
|
|
|
We have data about `r nrow(diamonds)` diamonds.
|
|
|
|
Only `r nrow(diamonds) - nrow(smaller)` are larger than 2.5 carats.
|
|
|
|
The distribution of the remainder is shown below:
|
|
|
|
|
|
|
|
```{r}
|
|
|
|
#| label: plot-smaller-diamonds
|
|
|
|
#| echo: false
|
|
|
|
|
|
|
|
smaller |>
|
2022-12-13 02:35:15 +08:00
|
|
|
ggplot(aes(x = carat)) +
|
2022-10-22 06:12:48 +08:00
|
|
|
geom_freqpoly(binwidth = 0.01)
|
|
|
|
```
|