summarize_offender: Summarize NIBRS offender demographic data

Description Usage Arguments Details Examples

View source: R/offender.R

Description

summarize_offender() is a function that queries offender demographic information from FBI Crime API and returns a data frame. You can specify offense type, aggregation level (national, agencies, regions, or states), and aggregation variable (age, ethnicity, etc.) in this function.

Usage

1
2
3
4
5
6
summarize_offender(
  offense,
  level = "national",
  level_detail = NULL,
  variable = "count"
)

Arguments

offense

a string or a list, the offense type(s) to request. Required.

level

a string, the level of aggregation. It can be national, agencies, regions, or states. If omitted, national is assumed.

level_detail

a string or a list. Use this parameter to indicate what are the agencies/regions/states you want to query. For example, when level = 'agencies', then specify the ORI code of the agencies here. If level = 'regions' , then specify what regions to include here. There are four region categories available for choosing: Northeast, Midwest, West, and South. If level = 'states', then specify state abbreviations here, e.g. c('AL', 'AZ'). Note, when level = 'national', this parameter should be NULL.

variable

a string, the rule for aggregating. It can be age, ethnicity, race, sex, or count. If omitted, count is assumed.

Details

Before calling any querying functions, you should pass your API KEY with set_fbi_crime_api_key().

Examples

1
2
3
4
summarize_offender(offense = 'burglary')
summarize_offender(offense = 'aggravated-assault', level = 'agencies', level_detail = 'MA0010100', variable = 'age')
summarize_offender(offense = c('burglary','arson'), level = 'regions', level_detail = c('Northeast','South'), variable = 'sex')
summarize_offender(offense = 'arson', level = 'states', level_detail = 'NH', variable = 'race')

SUN-Wenjun/fbicrime documentation built on Dec. 25, 2019, 5:12 a.m.