Skip to contents

[Stable]

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

Usage

get_brazil_state_code(x = NULL)

Arguments

x

(Optional) A character vector with the names of Brazilian states or federal units. If NULL, returns all state codes (Default: NULL).

Value

A character vector with the IBGE codes of Brazilian states.

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

get_brazil_state_code()
#>                Acre             Alagoas               Amapá            Amazonas 
#>                  12                  27                  16                  13 
#>               Bahia               Ceará    Distrito Federal      Espírito Santo 
#>                  29                  23                  53                  32 
#>               Goiás            Maranhão         Mato Grosso  Mato Grosso do Sul 
#>                  52                  21                  51                  50 
#>        Minas Gerais                Pará             Paraíba              Paraná 
#>                  31                  15                  25                  41 
#>          Pernambuco               Piauí      Rio de Janeiro Rio Grande do Norte 
#>                  26                  22                  33                  24 
#>   Rio Grande do Sul            Rondônia             Roraima      Santa Catarina 
#>                  43                  11                  14                  42 
#>           São Paulo             Sergipe           Tocantins 
#>                  35                  28                  17 

get_brazil_state_code("acre")
#> [1] 12
#> [1] 12 # Expected

get_brazil_state_code("ac")
#> [1] 12
#> [1] 12 # Expected