Description set_fbi_crime_api_key() function count_offense() function summarize_offender() function summarize_victim() function summarize_arrest() function
The fbicrime provides four important functions for querying crime data from FBI Crime API
(i.e. count_offense()
, summarize_offender()
, summarize_victim()
, and summarize_arrest()
)
and one convenience function (i.e. set_fbi_crime_api_key()
) for setting API key as a global option.
set_fbi_crime_api_key()
sets the input API key as a global option so that you don't need to
specify the key every time. Before calling querying functions, you should pass your API
KEY with this function. If global environment is reset, you will need to
pass the key again with this function.
Please visit the following URL to get a key for the API: https://api.data.gov/signup/
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.
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.
summarize_victim()
is a function that queries victim 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.
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.