Skip to contents

NYPD Stop, Question and Frisk (SQF) microdata via NYC OpenData.

Usage

morie_datasets_nyc_stop_and_frisk(
  year = NULL,
  max_features = NULL,
  offline = TRUE,
  paginate = FALSE,
  page_size = 1000L,
  max_pages = 200L
)

Arguments

year

Integer or NULL; release year (one of 2022, 2023, 2024). NULL defaults to the most-recent registered year.

max_features

Integer or NULL; cap on returned rows. When paginate = TRUE this is the total cap across all walked pages.

offline

Logical; if TRUE, return the included synthetic frame.

paginate

Logical; if TRUE and offline = FALSE, walk SODA2 $offset in page_size chunks. Default FALSE.

page_size

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

max_pages

Integer; safety net on paginated walks (default 200).

Value

A data.frame. Schema is NOT normalised across years.

Examples

df <- morie_datasets_nyc_stop_and_frisk(offline = TRUE)
#> Warning: morie_datasets_nyc_stop_and_frisk(offline=TRUE): using the bundled synthetic nyc_stop_and_frisk frame. This is a toy dataset with the documented schema but random data; do not interpret outputs as findings about the real population.
head(df[, c("STOP_FRISK_ID", "STOP_FRISK_DATE", "FRISKED_FLAG")])
#>        STOP_FRISK_ID STOP_FRISK_DATE FRISKED_FLAG
#> 1 SQF-SYNTH-2024-001      2024-03-15            Y
#> 2 SQF-SYNTH-2024-002      2024-05-22            Y
#> 3 SQF-SYNTH-2024-003      2024-08-10            N
#> 4 SQF-SYNTH-2024-004      2024-11-02            Y
#> 5 SQF-SYNTH-2024-005      2024-12-20            N