| extrair_codigo_ibge | R Documentation |
Extracts the first territorial code embedded in labels such as '"500270 Campo Grande"' and then validates and converts it with [normalizar_codigo_ibge()].
extrair_codigo_ibge(
x,
nivel = c("municipio", "uf", "regiao"),
formato = NULL,
desconhecido = c("erro", "na", "manter")
)
x |
Character vector containing codes or labeled values. |
nivel |
Territorial level: '"municipio"', '"uf"' or '"regiao"'. |
formato |
Output format. Municipalities support '"ibge"' (seven digits) and '"datasus"' (six digits). States and regions additionally support '"sigla"' and '"nome"'. |
desconhecido |
How to handle unknown values: '"erro"', '"na"' or '"manter"'. |
A normalized character vector.
extrair_codigo_ibge(c("500270 Campo Grande", "500370 Dourados"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.