Skip to contents

Cross-tabulates a categorical outcome column (default director_decision_category) by service, reporting both raw counts and within-service shares. If the supplied outcome_col is not present, looks for a few common alternatives (director_decision, outcome, decision, director_decision_outcome, director_decision_text). The SIU corpus that rmorie ships (morie_fetch_siu()) carries the Director's decision in charges_recommended; when none of the category columns exists, the outcome is derived from it as "charges" / "no charges" (booleans and the Director's own wording, e.g. "No Charges to Issue", both count; unreadable values are dropped).

Usage

mrm_siu_outcome_classifier(
  data,
  outcome_col = "director_decision_category",
  service_col = "police_service"
)

Arguments

data

A data.frame in the SIU case schema.

outcome_col

Outcome category column (default "director_decision_category").

service_col

Police-service column (default "police_service").

Value

A data.frame with columns service, outcome, n_cases, share_within_service.

Examples

siu <- data.frame(
  police_service = c("Toronto Police Service", "Toronto Police Service",
                     "Ontario Provincial Police"),
  charges_recommended = c(TRUE, FALSE, FALSE))
mrm_siu_outcome_classifier(siu)
#>                     service    outcome n_cases share_within_service
#> 1    Toronto Police Service    charges       1                  0.5
#> 2 Ontario Provincial Police no charges       1                  1.0
#> 3    Toronto Police Service no charges       1                  0.5