View source: R/get_brazil_municipalities.R
get_brazil_municipalities | R Documentation |
This function retrieves a list of municipalities from the Brazilian IBGE API using the state abbreviation (UF). It includes the name of each municipality and its official IBGE code.
get_brazil_municipalities(uf)
uf |
A two-letter string representing the Brazilian state abbreviation (e.g., "SP", "RJ", "BA"). |
The function sends a GET request to the BrasilAPI IBGE endpoint. If the UF (state abbreviation)
is invalid or not recognized, the function returns NULL
with an appropriate message.
A data frame (tibble) with the following columns:
nome
: Name of the municipality.
codigo_ibge
: Official IBGE code for the municipality (as character).
Requires internet access. Official IBGE codes are widely used for geostatistical analysis and identification of Brazilian municipalities.
GET
, fromJSON
, as_tibble
## Not run:
municipalities_sp <- get_brazil_municipalities("SP")
head(municipalities_sp)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.