One-call Chicago crime + boundary + dictionary join
Source:R/datasets.R
morie_datasets_chicago_crime_resolved.RdPhase 3VV+. Pulls a slice of morie_datasets_chicago_crime()
and left-joins each of its five canonical foreign keys against
the matching resolver dataset shipped in morie:
Arguments
- year
Integer or
NULL; server-side year filter.- max_features
Integer or
NULL; cap on returned rows. Whenpaginate = TRUEthis is the total cap across all walked pages.- offline
Logical; if
TRUE, return the bundled synthetic frame.- mode
One of
"soda2"(default) or"soda3". Selects the API path for live mode:"soda2"->/resource/<id>.json?$where=...via.morie_dataset_socrata_fetch()(URL-param SoQL grammar)."soda3"->/api/v3/views/<id>/query.json?query=SELECT ...via.morie_dataset_soda3_query()(full SoQL passthrough). Both modes return the same 22-column schema; SODA3 is required when a derived/map view is involved (none here, but available for parity withmorie_datasets_chicago_crime_map()) and for the canonical "single SoQL string" experience.
- paginate
Logical; if
TRUEandoffline = FALSE, walk pagination inpage_sizechunks. SODA2 uses$offset; SODA3 usesLIMIT page_size OFFSET mbaked into the SoQL.- page_size
Integer; per-page row count when
paginate = TRUE. Default 1,000 (the unauthenticated SODA2 ceiling).- max_pages
Integer; safety net on
paginate = TRUEwalks (default 200 -> up to 200,000 rows without an app_token).- app_token
Optional Socrata app token (SODA3 only – sent as the
X-App-Tokenheader; ignored undermode = "soda2").- resolvers
Character subset of the 5 resolver names to join. Default joins all 5. Pass a shorter vector to skip specific joins (e.g.
"iucr"only).
Value
A wide data.frame: crime columns first, then the
joined resolver columns with their canonical prefixes.
Details
| crime field | resolver | join key |
beat | morie_datasets_chicago_police_beats() | beat == beat_num |
district | morie_datasets_chicago_police_districts() | district == dist_num |
ward | morie_datasets_chicago_wards() | ward == ward |
community_area | morie_datasets_chicago_community_areas() | community_area == area_numbe |
iucr | morie_datasets_chicago_iucr_codes() | iucr == iucr |
The resolvers are loaded in offline mode (they're all bundled +
small), so this analyzer only touches the network for the crime
pull itself. Resolver columns are prefixed with the source name
(ward_*, community_*, beat_*, district_*, iucr_*) to
avoid collisions with the crime schema.
Both mode = "soda2" and mode = "soda3" are honoured for the
crime fetch, matching the dual-API design from 3VV+.
Examples
df <- morie_datasets_chicago_crime_resolved(
offline = TRUE,
max_features = 5L,
resolvers = c("ward", "iucr"))
#> Warning: morie_datasets_chicago_crime(offline=TRUE): using the bundled synthetic chicago_crime frame. This is a toy dataset with the documented schema but random data; do not interpret outputs as findings about the real population.
names(df)
#> [1] "iucr" "ward"
#> [3] "id" "case_number"
#> [5] "date" "block"
#> [7] "primary_type" "description"
#> [9] "location_description" "arrest"
#> [11] "domestic" "beat"
#> [13] "district" "community_area"
#> [15] "fbi_code" "x_coordinate"
#> [17] "y_coordinate" "year"
#> [19] "updated_on" "latitude"
#> [21] "longitude" "location"
#> [23] "ward_shape_leng" "ward_shape_area"
#> [25] "iucr_primary_description" "iucr_secondary_description"
#> [27] "iucr_index_code" "iucr_active"