
Get Brazilian municipalities codes
Source:R/get_brazil_municipality_code.R
      get_brazil_municipality_code.Rdget_brazil_municipality() returns a vector with codes of the Brazilian
Institute of Geography and Statistics (IBGE) for
Brazilian municipalities.
Usage
get_brazil_municipality_code(
  municipality,
  state = NULL,
  year = as.numeric(substr(Sys.Date(), 1, 4)),
  names = TRUE,
  ...
)Arguments
- municipality
- (optional) A - charactervector with the name of the municipalities. If- NULLthe function returns all municipalities (default:- NULL).
- state
- (optional) A - charactervector with the name of the states (default:- NULL).
- year
- (optional) An - integerishnumber indicating the year of the data regarding the municipalities (default:- Sys.Date() |> substr(1, 4) |> as.numeric()).
- names
- (optional) A - logicalflag indicating whether to return the names of the municipalities as names of the vector (default:- TRUE).
- ...
- (optional) Additional arguments passed to - get_brazil_municipality().
Value
An integer vector with the IBGE codes of
Brazilian municipalities.
Details
The data from this function is based on data from the Brazilian Institute
of Geography and Statistics (IBGE) via the
geobr R package.
The geobr package is produced by Brazil's Institute for
Applied Economic Research (IPEA) and access the
Brazilian Institute of Geography and Statistics (IBGE) data. You can see a
list of all geobr datasets by running
geobr::list_geobr().
See also
Other Brazil functions:
get_brazil_fu(),
get_brazil_municipality(),
get_brazil_municipality_coords(),
get_brazil_municipality_latitude(),
get_brazil_municipality_longitude(),
get_brazil_region(),
get_brazil_region_code(),
get_brazil_state(),
get_brazil_state_by_utc(),
get_brazil_state_capital(),
get_brazil_state_code(),
get_brazil_state_latitude(),
get_brazil_state_longitude(),
render_brazil_address()
Examples
if (FALSE) { # \dontrun{
  get_brazil_municipality_code(municipality = "Belém")
  get_brazil_municipality_code(municipality = "Belém", names = FALSE)
  get_brazil_municipality_code(municipality = "Belém", state = "Pará")
  get_brazil_municipality_code(c("Rio de Janeiro", "São Paulo"))
} # }