Generated 2026-07-27. The data URL below is pinned to commit 50230db9b, a
snapshot of the dataset as of this exercise — so your numbers should match these exactly.
floor_date(day, "week", week_start = 1) then group_by(week)). Is last week unusual among them?library(tidyverse)
library(lubridate)
activity <- read_csv("https://raw.githubusercontent.com/dwillis/umpd-logs/50230db9b5b8bcb0c0c5600a2271aed8413a09c0/data/all-police-activity.csv")
week_start <- ymd("2026-07-20")
daily <- activity |>
mutate(day = as_date(`Date Occurred`)) |>
filter(day >= week_start, day < week_start + days(7)) |>
count(day, name = "incidents") |>
complete(day = seq(week_start, week_start + days(6), by = "day"),
fill = list(incidents = 0))
daily |>
summarize(total = sum(incidents),
mean_per_day = round(mean(incidents), 1),
median_per_day = median(incidents))
Your summarize() output should match "This week's numbers" above: total 7,
mean 1.0, median 1. All values here use round(x, 1), which
rounds halves to the nearest even digit — the same rule as R's round().
Stuck on the concepts? The site's Learn pages walk through every technique used here, with this same dataset.