Skip to contents

Third 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 $filter string (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 TRUE reads the bundled 22-col chicago_crime_synthetic.csv fixture.

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).

Value

A data.frame.

Details

When to reach for which API mode:

Modemorie wrapperbest for
SODA2morie_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 v4morie_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.

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