Skip to contents

NYPD Complaint Data Historic

Usage

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

Arguments

year

Optional year filter (server-side SoQL).

max_features

Optional row cap. When paginate = TRUE this is the total cap across walked pages.

offline

If TRUE (default), read the included fixture.

resource_id

Optional Socrata resource id override.

paginate

Logical; if TRUE and offline = FALSE, walk SODA2 $offset in page_size chunks until exhausted or max_features is reached. Default FALSE (single 1,000-row request, matching the historical pre-3OO behaviour).

page_size

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

max_pages

Safety net on paginated walks (default 200 -> up to 200,000 rows without an app_token).

mode

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

app_token

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

Value

A data.frame.

Examples

df <- morie_datasets_nyc_nypd_complaint_historic(offline = TRUE)
head(df[, c("cmplnt_num", "ofns_desc", "boro_nm")])
#>          cmplnt_num                      ofns_desc       boro_nm
#> 1 NYPD-CH-SYNTH-001                        ROBBERY         BRONX
#> 2 NYPD-CH-SYNTH-002   ASSAULT 3 & RELATED OFFENSES     MANHATTAN
#> 3 NYPD-CH-SYNTH-003 CRIMINAL MISCHIEF & RELATED OF      BROOKLYN
#> 4 NYPD-CH-SYNTH-004                DANGEROUS DRUGS        QUEENS
#> 5 NYPD-CH-SYNTH-005                  PETIT LARCENY STATEN ISLAND