Description Usage Arguments Details Examples
summarize_arrest() is a function that queries arrest information from FBI Crime API and returns a data frame.
You can choose whether to summarize by offense type or not with by_offense_type
and input the offense(s) with offense
.
You can also specify aggregation level (national, agencies, regions, or states), aggregation variable (age, ethnicity, etc.), and time span in this function.
1 2 3 4 5 6 7 8 9 | summarize_arrest(
by_offense_type = FALSE,
offense = NULL,
level = "national",
level_detail = NULL,
variable,
since,
until
)
|
by_offense_type |
a boolean. |
offense |
a string or a list, the offense type(s) to request.
If omitted, |
level |
a string, the level of aggregation. It can be |
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 |
variable |
a string, the rule for aggregating. The availale arguments for this parameter vary for different endpoints of the API. Please check the API document (https://crime-data-explorer.fr.cloud.gov/api) for details. Required. |
since |
a number, the year to start |
until |
a number, the year to end |
Before calling any querying functions, you should pass your API KEY with set_fbi_crime_api_key()
.
1 2 3 4 | summarize_arrest(by_offense_type = TRUE, offense = c('aggravated-assault','rape'), level = 'states', level_detail = c('NY','MA'), variable = 'race', since = 2010, until = 2011)
summarize_arrest(by_offense_type = TRUE, offense = c('aggravated-assault','rape'), variable = 'race', since = 2010, until = 2011)
summarize_arrest(by_offense_type = FALSE, level = 'regions', level_detail = c('South','Midwest'), variable = 'all', since = 2015, until = 2016)
summarize_arrest(by_offense_type = FALSE, variable = 'all', since = 2015, until = 2016)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.