Format state codes with leading zeroes

str_mxstate(code)

Arguments

code

The state code according to the INEGI's Catalogo de entidades federativas, municipios y localidades

Value

The state code in the format required by the plotting functions

Examples

str_mxstate(c("12", "2"))
#> [1] "12" "02"
str_mxstate(c(32, 5))
#> [1] "32" "05"

if (FALSE) {
# warning about invalid state code
str_mxstate("35")
}