Skip to contents

Requires an API key (api_key= or FBI_CDE_API_KEY env var).

Usage

morie_datasets_nibrs(
  year = NULL,
  max_features = NULL,
  state = NULL,
  offense = NULL,
  api_key = NULL,
  offline = FALSE
)

Arguments

year

Integer; reporting year (required unless offline = TRUE).

max_features

Integer or NULL; cap on returned rows.

state

Character; two-letter US state code, or NULL for national.

offense

Character; NIBRS offence slug, or NULL for all.

api_key

Character; FBI CDE API key (or NULL -> env var).

offline

Logical; if TRUE, return a included synthetic frame.

Value

A data.frame.

Examples

df <- morie_datasets_nibrs(year = 2023L, offline = TRUE)
#> Warning: morie_datasets_nibrs(offline=TRUE): using the bundled synthetic nibrs 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)
#>          ori state_abbr offense_code             offense_name data_year
#> 1 SYN0000001         GA          13A       aggravated-assault      2023
#> 2 SYN0000002         GA          220                 burglary      2023
#> 3 SYN0000003         GA          23F theft-from-motor-vehicle      2023
#> 4 SYN0000004         CA          13A       aggravated-assault      2023
#> 5 SYN0000005         CA          220                 burglary      2023
#> 6 SYN0000006         CA          240      motor-vehicle-theft      2023
#>   incident_count
#> 1             42
#> 2             17
#> 3             29
#> 4             88
#> 5             54
#> 6             61