
Get Brazilian municipalities codes
Source:R/get_brazil_municipality_code.R
get_brazil_municipality_code.Rd
get_brazil_municipality()
returns a vector with codes of the Brazilian
Institute of Geography and Statistics (IBGE) for
Brazilian municipalities.
Arguments
- municipality
(Optional) A
character
vector with the name of the municipalities. IfNULL
the function returns all municipalities (Default:NULL
).- state
(Optional) A
character
vector with the name of the states (Default:NULL
).- year
(Optional) An
integerish
number indicating the year of the data regarding the municipalities (Default:2017
).- names
(Optional) A
logical
flag indicating whether to return the names of the municipalities as names of the vector (Default:TRUE
).
Value
An integer
vector with the municipalities codes.
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_region()
,
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
get_brazil_municipality_code(municipality = "Belém")
#> Belém-PA Belém-PB Belém-AL
#> 1501402 2501906 2700805
get_brazil_municipality_code(municipality = "Belém", names = FALSE)
#> [1] 1501402 2501906 2700805
get_brazil_municipality_code(municipality = "Belém", state = "Pará")
#> Belém-PA
#> 1501402
get_brazil_municipality_code(municipality = c("Rio de Janeiro", "São Paulo"))
#> Rio de Janeiro-RJ São Paulo-SP
#> 3304557 3550308