← All exercises · Download the Markdown source on GitHub

UMPD Data Exercise — Week of July 13, 2026 – July 19, 2026

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

This week's numbers

Questions

  1. Write one sentence for a campus-news brief using the mean, and one using the median. Do they leave the reader with different impressions? Which is fairer?
  2. Careful: at least one of the two weeks being compared has fewer than 5 incidents (4 vs. 24). Explain in two sentences why the -83.3% figure above should NOT appear in a story, and what you would report instead.
  3. Rewrite the percent change above as a plain-language sentence a reader can check ("about X incidents a day, up from Y a year earlier"). Why might raw numbers serve readers better than percentages when counts are small?
  4. The Trends page compares semesters (Spring = Feb–Apr, Fall = Sep–Nov) instead of calendar quarters. What error does that choice avoid? What would a January-to-March "quarter" mix together on a university campus?
  5. In R, compute incidents per day for last week and for the same week last year, then the percent change between their means. Confirm you get the number printed above (both use round(x, 1)).

Starter code (R)

library(tidyverse)
library(lubridate)

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

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

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.