City of Chicago Crimes feed via OData v4 (ijzp-q8t2)
Source: R/datasets.R
morie_datasets_chicago_crime_odata.RdThird Socrata API mode: OData v4 at
/api/odata/v4/<view_id>, the same protocol Tableau / Power BI /
Excel speak natively. Use this when you want morie to consume the
Crimes feed the same way those tools do, or when you want
server-driven @odata.nextLink pagination instead of the
client-driven $offset walk that SODA2/SODA3 use.
Usage
morie_datasets_chicago_crime_odata(
filter = NULL,
select = NULL,
orderby = NULL,
top = NULL,
skip = NULL,
max_features = NULL,
offline = TRUE,
resource_id = NULL,
paginate = FALSE,
max_pages = 200L,
app_token = NULL
)Arguments
- filter
Optional OData
$filterstring (caller-supplied verbatim; see limitation above).- select
Optional comma-separated column list.
- orderby
Optional OData
$orderby.- top
Optional per-request row count (=
$top).- skip
Optional start offset (=
$skip).- max_features
Optional total row cap across pages.
- offline
Logical; default
TRUEreads the bundled 22-colchicago_crime_synthetic.csvfixture.- resource_id
Optional view id override (default
"ijzp-q8t2"; pass"crimes"for the publisher alias).- paginate
Logical; if
TRUE, follow@odata.nextLink.- max_pages
Safety net on paginated walks.
- app_token
Optional Socrata app token (sent as
X-App-Token).
Details
When to reach for which API mode:
| Mode | morie wrapper | best for |
| SODA2 | morie_datasets_chicago_crime() | base-feed pulls + $where filtering |
| SODA3 (SoQL) | morie_datasets_chicago_crime_soql() | arbitrary SELECT ... WHERE |
| SODA3 (map view) | morie_datasets_chicago_crime_map() | derived/filtered views (ahwe-kpsy) |
| OData v4 | morie_datasets_chicago_crime_odata() | third-party tool ingestion |
Known Socrata limitation. $filter is unreliable on Socrata's
OData implementation – the parser frequently rejects equality
filters with "The types 'Edm.Boolean' and 'Edm.String' (or 'Edm.Decimal') are not compatible.". $top / $skip /
$select / $orderby all work; for filtering, use SODA3.
References
Socrata OData docs: https://support.socrata.com/hc/en-us/articles/115005364207-Access-Data-Insights-Data-using-OData
Examples
df <- morie_datasets_chicago_crime_odata(offline = TRUE)
#> Warning: morie_datasets_chicago_crime_odata(offline=TRUE): using the bundled synthetic chicago_crime_odata 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