← All exercises · Download the Markdown source on GitHub

UMPD Data Exercise — Week of July 6, 2026 – July 12, 2026

Generated 2026-07-13. The data URL below is pinned to commit 4aa3b423e, a snapshot of the dataset as of this exercise — so your numbers should match these exactly.

This week's numbers

Questions

  1. If one day last week had seen a big spike — say 30 incidents — how would the mean have changed? How about the median? (You can test this in R by editing one value.) What does that tell you about which average to trust on skewed data?
  2. Careful: at least one of the two weeks being compared has fewer than 5 incidents (4 vs. 21). Explain in two sentences why the -81.0% figure above should NOT appear in a story, and what you would report instead.
  3. The comparison above uses the same calendar week last year. Why is that fairer than comparing last week to the week before? Name one rhythm in campus life that would fool a week-over-week comparison.
  4. Find the crime type with the biggest percent change between the last two full months (group by month and Crime Type in R). Would you report it? Apply the small-number test: what are the raw counts behind the percentage?
  5. In R, count last week's incidents by 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?

Starter code (R)

library(tidyverse)
library(lubridate)

activity <- read_csv("https://raw.githubusercontent.com/dwillis/umpd-logs/4aa3b423e9bc941f703a8f977f5fb10fc214d699/data/all-police-activity.csv")

week_start <- ymd("2026-07-06")

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))

Check your work

Your summarize() output should match "This week's numbers" above: total 4, mean 0.6, median 0. 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.