Skip to contents

brazil_region_code() returns a vector with the Brazilian Institute of Geography and Statistics (IBGE) codes for Brazilian regions.

Usage

brazil_region_code(x = NULL)

Arguments

x

(optional) A character vector containing the names of Brazilian regions, states, or federal units. If NULL, returns a named vector with all Brazilian region codes (default: NULL).

Value

An integer vector with the IBGE codes of Brazilian regions.

Details

The data from this function is based on data from the Brazilian Institute of Geography and Statistics (IBGE, n.d.).

References

Instituto Brasileiro de Geografia e Estatística. (n.d.). Território [Territory] [Dataset]. SIDRA. https://sidra.ibge.gov.br/territorio

Examples

brazil_region_code()
#>        North    Northeast    Southeast        South Central-West 
#>            1            2            3            4            5 

brazil_region_code("north")
#> [1] 1
#> [1] 1 # Expected

brazil_region_code(c("north", "central-west"))
#> [1] 1 5
#> [1] 1 5 # Expected

brazil_region_code("sao paulo")
#> [1] 3
#> [1] 3 # Expected

brazil_region_code("sp")
#> [1] 3
#> [1] 3 # Expected