get_fogocruzado: Extract data from Fogo Cruzado's API of shootings in Brazil.

View source: R/get_fogocruzado.R

get_fogocruzadoR Documentation

Extract data from Fogo Cruzado's API of shootings in Brazil.

Description

get_fogocruzado() extracts data from shootings and fire gun shots from Fogo Cruzado's API (https://api.fogocruzado.org.br/). The function returns a data.frame where each observation corresponds to an occurrence.

Usage

get_fogocruzado(
  city = NULL,
  initial_date = Sys.Date() - months(6),
  final_date = Sys.Date(),
  state = c("PE", "RJ"),
  security_agent = c(0:1)
)

Arguments

city

City (character). Filters observations to certain cities. Complete names of the cities included in the data can be found using the get_cities function. Default returns occurrences from all cities in the data repository.

initial_date

initial date to filter occurrences starting from a certain day. character in the "YYYY-MM-DD" format. Default is set to six months from the current date. The difference betweet the final and the initial dates cannot be longer than 210 days (roughly 7 months).

final_date

final date to filter occurrences up until in a certain day. character in the "YYYY-MM-DD" format. Default is set for the current day Sys.Date(). The difference betweet the final and the initial dates cannot be longer than 210 days (roughly 7 months).

state

State abbreviation in capital letters (character). Filters observations to contain only the selected state. Default returns occurrences from both states in the data repository. Can assume 2 values: "RJ" for occurrences in the state of Rio de Janeiro and "PE" for those of Pernambuco.

security_agent

Number (integer) indicating if the user wishes to filter observations according to the presence of security agents in the occurrence. Can assume the values of 1 for "yes" and 0 for "no". Default returns all occurrences.

Value

A data.frame with 67 columns. They are described in English and in Portuguese.

See Also

get_cities fogocruzado_signin

Examples

# returns a data.frame with all occurrences in the data repository over the last 210 days

## Not run: 
df <- get_fogocruzado()

## End(Not run)

# returns a data.frame with all occurrences in the city of Belford Roxo
# starting in January 1st, 2017 and finishing in June 30th, 2018.

## Not run: 
df <- get_fogocruzado(city = "Belford Roxo", initial_date = "2017-01-01", final_date = "2018-06-31")

## End(Not run)

voltdatalab/crossfire documentation built on Oct. 30, 2023, 7:11 p.m.