Skip to contents

Mirrors morie_tps_csi_per_year but groups by neighbourhood ID rather than fiscal year. Population is not divided in here because TPS open data does not ship a per-ward population table; callers are expected to merge in the City of Toronto Open Data NeighbourhoodCrimeRates per-ward population for per-capita rates. Returns the un-normalised weighted sum + total count.

Usage

morie_tps_csi_per_neighbourhood(
  counts_per_hood,
  variant = c("total", "violent"),
  weights = NULL
)

Arguments

counts_per_hood

Long data.frame (columns HOOD_158, category, count) or nested list [[hood]][[category]] = count.

variant

One of "total" or "violent".

weights

Optional override vector of weights.

Value

A data.frame with one row per neighbourhood.