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
)Examples
counts <- data.frame(HOOD_158 = rep(sprintf("%03d", 1:4), 2),
category = rep(c("Assault", "Robbery"), each = 4),
n = rpois(8, 50))
res <- try(morie_tps_csi_per_neighbourhood(counts))
#> Error : long-format data.frame must have columns HOOD_158, category, count
if (!inherits(res, "try-error")) str(res, max.level = 1)
