::: {.cell hash='03_Data_preprocessing_cache/revealjs/fraction_delayed_530466613ac025791f641fa5f8cc7279'}

```{.r .cell-code}
all_counts <- flights %>%
  filter(!is.na(dep_delay)) %>%
  count(month)

delayed_flights <- flights %>%
  filter(!is.na(dep_delay)) %>%
  filter(dep_delay > 0) %>%
  count(month) %>%
  rename(n_delayed = n)

inner_join(delayed_flights, all_counts, 
           by="month") %>%
  mutate(
    fraction_delayed = n_delayed / n
  ) %>%
  select(month, fraction_delayed)
```
:::