Skip to contents

Wraps the City of Chicago "Arrests" open dataset (Socrata resource id dpt3-jri9; portal landing https://data.cityofchicago.org/Public-Safety/Arrests/dpt3-jri9/about_data). 24 columns covering up to four charges per arrest plus the pipe-concatenated rollup quartet (charges_statute / charges_description / charges_type / charges_class).

Usage

morie_datasets_chicago_arrests(
  year = NULL,
  max_features = NULL,
  offline = TRUE,
  resource_id = NULL,
  mode = c("soda2", "soda3"),
  paginate = FALSE,
  page_size = 1000L,
  max_pages = 200L,
  app_token = NULL
)

Arguments

year

Integer or NULL; server-side year filter (uses date_extract_y(arrest_date) = <year> SoQL).

max_features

Integer or NULL; cap on returned rows. When paginate = TRUE this is the total cap across walked pages.

offline

Logical; if TRUE (default, safer post-3EE), read the bundled synthetic frame.

resource_id

Optional Socrata resource id override. Accepts the UUID (dpt3-jri9, default) or the publisher's alias (arrests).

mode

One of "soda2" (default JSON resource endpoint) or "soda3" (SoQL query endpoint). 3VV+ dual-mode dispatch.

paginate

Logical; if TRUE and offline = FALSE, walk SODA2 $offset in page_size chunks. Default FALSE.

page_size

Per-page row count when paginating (default 1,000, the unauthenticated SODA2 ceiling).

max_pages

Safety net on paginated walks (default 200).

app_token

Optional Socrata API app token for higher rate limits; passed as the X-App-Token header.

Value

A data.frame with the documented 24-col Socrata schema.

Details

Socrata accepts two resource specifiers interchangeably – the numeric/UUID id (/resource/dpt3-jri9.json) and the human-readable alias the publisher assigned (/resource/arrests.json). morie defaults to the UUID for stability; pass resource_id = "arrests" if you want to exercise the alias path.

Offline mode reads a bundled 5-row synthetic fixture (inst/extdata/chicago_arrests_dpt3_jri9_sample.csv) carrying the real upstream snake_case schema. Live mode hits the SODA2 endpoint via .morie_dataset_socrata_fetch() and honours the 3OO opt-in pagination (paginate = TRUE).

References

City of Chicago Data Portal, "Arrests" (dpt3-jri9).

Examples

df <- morie_datasets_chicago_arrests(offline = TRUE)
df$arrest_date
#> [1] "2024-03-15T10:30:00.000" "2024-06-22T14:15:00.000"
#> [3] "2025-01-08T22:45:00.000" "2025-04-19T03:20:00.000"
#> [5] "2025-09-30T18:00:00.000"