Description Usage Arguments Details Examples
count_offense() is a function that queries the count of different types of offense from FBI Crime API and returns a data frame based on the query result. You can specify offense type, level of aggregation (national, agencies, regions, or states), and selected levels (i.e. what are the states/regions/agencies you want to include) in this function.
1 | count_offense(offense, level = "national", level_detail = NULL)
|
offense |
a string or a list, the offense type(s) to request. Required. |
level |
a string, the level of aggregation for counting. 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 |
Before calling any querying functions, you should pass your API KEY with set_fbi_crime_api_key()
.
1 2 3 4 | count_offense(offense = 'burglary')
count_offense(offense = 'larceny', level = 'agencies', level_detail = 'MA0010100')
count_offense(offense = c('burglary','larceny'), level = 'regions', level_detail = c('South','Northeast'))
count_offense(offense = 'homicide', level = 'states', level_detail = c('AL', 'AZ'))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.