Cross-category crime analyses for Toronto Police Service (TPS) datasets
Source:R/tps_crime.R
tps_crime.RdR-side port of morie.tps_crime. Where the Python module
uses TPS_REGISTRY + load_tps_dataset to materialise
per-category data.frames, the R-side callables here accept a named
list of pre-loaded data.frames (one entry per TPS category) via the
dfs argument. Callers are responsible for loading the CSVs
(e.g. via utils::read.csv or readr::read_csv) and
passing them in keyed by canonical TPS category name (e.g.
"Assault", "Homicides", "BicycleTheft").
Details
Callables:
morie_tps_yoy_panel(): side-by-side year-over-year panel across TPS categories.morie_tps_composite_index(): per-neighbourhood composite crime-risk index (sum of z-standardised counts, optionally weighted).morie_tps_bivariate_morans_i(): bivariate Moran's I between two TPS categories on a shared HOOD_158 footprint using a k-NN row-standardised spatial weights matrix.morie_tps_category_correlation_matrix(): Pearson r on per-hood incident counts across all supplied categories.
Each callable returns a named list with class
c("morie_tps_result", "morie_rich_result", "list") carrying
title, summary_lines, tables (when applicable),
interpretation, warnings, and a free-form
payload.