crossfire is a package created to give easier access to the datasets of the project Fogo Cruzado, which is a digital collaboration platform to register gun shootings in the metropolitan areas of Rio de Janeiro and Recife.
Installing and loading the package
crossfire package can be installed directly from its GitHub repository:
if (!require("devtools")) install.packages("devtools") devtools::install_github("voltdatalab/crossfire") library(crossfire)
crossfire has 3 functions:
fogocruzado_signinis used to give access to Fogo Cruzado's API. To access Fogo Cruzado's API, users should be registered and insert their e-mail and password for authentication. Thus, the function registers these information on the current R session, so that it can be used to obtain the Bearer token to extract data using the API.
get_fogocruzadoextracts slices or the whole dataset of shootings registered by Fogo Cruzado. The function returns a data frame, in which each line corresponds to a shooting registered and its information. It can also filter the data according to some parameters, city/state -
state-, initial and final date -
final_date-, the presence of security forces -
security_agent-, and the information source -
# Extract data for all registered shootings fogocruzado_all <- get_fogocruzado() # Extract data for shootings in the cities of Rio de Janeiro and Recife in 2018 fogocruzado_rj_recife <- get_fogocruzado(city = c("Rio de Janeiro", "Recife"), initial_date = "2018-01-01", final_date = "2018-12-31") # Extract data from occurents reported by the police and in which security agents were present fogocruzado_security <- get_fogocruzado(security_agent = 1, source = 2)
data.framewith information about all cities from the Rio de Janeiro and Recife metropolitan areas covered by the Fogo Cruzado initiative.