City of Chicago Crimes feed – arbitrary-SoQL escape hatch
Source:R/datasets.R
morie_datasets_chicago_crime_soql.RdSibling to morie_datasets_chicago_crime() but hits the
SODA3 /api/v3/views/crimes/query.json endpoint instead of
SODA2's /resource/ijzp-q8t2.json. The 8.56M-row scale of the
base feed makes SODA2's URL-param $where clumsy for non-trivial
filters; SODA3 lets you send the full SoQL SELECT ... WHERE ... ORDER BY ... string in one go.
Usage
morie_datasets_chicago_crime_soql(
where = NULL,
select = "*",
order = NULL,
max_features = NULL,
offline = TRUE,
resource_id = NULL,
paginate = FALSE,
page_size = 1000L,
max_pages = 200L,
app_token = NULL
)Arguments
- where
Optional SoQL
WHEREfragment (without leadingWHERE). e.g."primary_type='HOMICIDE' AND year=2024".- select
Projection list (default
"*").- order
Optional SoQL
ORDER BYfragment.- max_features
Optional total row cap.
- offline
Logical; if
TRUE(default), read the 22-colchicago_crime_synthetic.csvfixture (same onemorie_datasets_chicago_crime()uses).- resource_id
Optional view id override (default
"ijzp-q8t2"; pass"crimes"for the publisher alias path).- paginate
Logical; opt-in pagination.
- page_size
Per-page row count when paginating.
- max_pages
Safety net.
- app_token
Optional Socrata app token (sent as header).
Examples
df <- morie_datasets_chicago_crime_soql(offline = TRUE)
#> Warning: morie_datasets_chicago_crime_soql(offline=TRUE): using the bundled synthetic chicago_crime_soql frame. This is a toy dataset with the documented schema but random data; do not interpret outputs as findings about the real population.
nrow(df)
#> [1] 5