Convenience wrapper that runs each of the analysis surfaces and
optionally writes a .txt dump (and .json payload if
jsonlite is available) per result. Failures are captured
per-analysis: one bad surface does not stop the rest.
Arguments
- data
Either a data frame (e.g. the output of
morie_fetch_siu()read in) or a path toSIU_by_case.csv.NULL(the default) looks infile.path(tempdir(), "morie", "siu", "SIU_by_case.csv").- out_dir
Optional directory; if non-
NULL, each result is written assiu_analysis_<name>.txt.
Examples
df <- data.frame(
police_service = rep(c("Toronto Police Service", "Ontario Provincial Police"), 4),
charges_recommended = rep(c(TRUE, FALSE), each = 4),
date_of_incident_iso = rep(c("2022-01-05", "2023-02-18", "2024-03-01", "2024-11-11"), 2),
date_siu_notified_iso = rep(c("2022-01-06", "2023-02-19", "2024-03-02", "2024-11-12"), 2),
date_of_director_decision_iso = rep(c("2022-08-01", "2023-09-10", "2024-09-01", "2025-02-14"), 2),
sex_gender_affected = rep(c("Male", "Female"), 4),
age_affected = c("34", "27", "55", "19", "42", "31", "48", "29"),
mental_health_or_race_indications = rep(c("mental health; Indigenous", ""), 4))
res <- morie_siu_all_analyses(df)
names(res)
#> [1] "by_police_service" "by_year" "case_counts"
#> [4] "demographics" "mh_race_indicators" "decision_timing"
#> [7] "charges_year_chi2"
