Generated 2026-09-14. The data URL below is pinned to commit 4bd0a6251, a
snapshot of the dataset as of this exercise — so your numbers should match these exactly.
Crime Type in R). Would you report it? Apply the small-number test: what are the raw counts behind the percentage?Crime Type and sort descending. What share of the week is the top type? (mutate(share = n / sum(n)).) Does the "most common incident" match what you'd guess from campus-crime coverage?library(tidyverse)
library(lubridate)
activity <- read_csv("https://raw.githubusercontent.com/dwillis/umpd-logs/4bd0a62514c95bd05ed2e993e21e638de0f869a6/data/all-police-activity.csv")
week_start <- ymd("2026-09-07")
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 15,
mean 2.1, 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.