Skip to content

Commit

Permalink
Update with stats19
Browse files Browse the repository at this point in the history
  • Loading branch information
Robinlovelace committed May 20, 2024
1 parent f018a30 commit fcdd5de
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions paper.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,6 @@ d_all |>
# Results

```{r}
#| label: fig-time
#| fig-cap: "Monthly count of Operation Snap records, West Yorkshire"
d_all_monthly = d_all |>
mutate(month = lubridate::floor_date(date, "month")) |>
group_by(month) |>
Expand All @@ -247,6 +245,29 @@ d_complete_monthly = d |>
summarise(n = n()) |>
mutate(records = "complete")
d_monthly = bind_rows(d_all_monthly, d_complete_monthly)
```

```{r}
#| label: stats19
#| include: false
years = 2021:2022
dir.create("data/stats19", recursive = TRUE, showWarnings = FALSE)
collisions = stats19::get_stats19(year = 2022)
# collisions_2021 = stats19::get_stats19(year = 2021)
# collisions = purrr::map_df(years, stats19::get_stats19, type = "collision", data_dir = "data/stats19")
stats19_monthly = collisions |>
filter(police_force == "West Yorkshire") |>
mutate(month = lubridate::floor_date(date, "month")) |>
group_by(month) |>
summarise(n = n()) |>
mutate(records = "stats19")
```


```{r}
#| label: fig-time
#| fig-cap: "Monthly count of Operation Snap records, West Yorkshire"
d_monthly = bind_rows(d_monthly, stats19_monthly)
d_monthly |>
mutate(records = snakecase::to_title_case(records)) |>
rename_all(snakecase::to_title_case) |>
Expand Down

0 comments on commit fcdd5de

Please sign in to comment.