| esp_dict_region_code | R Documentation |
Convert Spanish subdivision names or identifiers between different coding schemes (NUTS, ISO2, province codes, etc.) or obtain human-readable names.
esp_dict_region_code(sourcevar, origin = "text", destination = "text")
esp_dict_translate(sourcevar, lang = "en", all = FALSE)
sourcevar |
character string. Vector which contains the codes or names to be converted. |
origin, destination |
character string. Coding scheme of origin and
destination. One of |
lang |
character string. Target language code, available values:
|
all |
logical. If |
The function uses internal dictionaries together with countrycode
to map between schemes. When origin == destination == "text" the input is
returned unchanged. Mixing names from different administrative levels
(for example autonomous community and province) may produce
NA values for some entries.
esp_dict_region_code() returns a character vector with converted
subdivision identifiers or names. If a value cannot be matched the
corresponding element will be NA and a warning is emitted via
cli::cli_alert_warning().
esp_dict_translate() translates a vector of names from one language to
another :
If all = FALSE, a character vector with the translated name for each
element of sourcevar.
If all = TRUE, a named list is returned where each element contains
all available translations for the corresponding input value.
vals <- c("Errioxa", "Coruna", "Gerona", "Madrid")
esp_dict_region_code(vals)
esp_dict_region_code(vals, destination = "nuts")
esp_dict_region_code(vals, destination = "cpro")
esp_dict_region_code(vals, destination = "iso2")
# From ISO2 to another codes
iso2vals <- c("ES-M", "ES-S", "ES-SG")
esp_dict_region_code(iso2vals, origin = "iso2")
esp_dict_region_code(iso2vals,
origin = "iso2",
destination = "nuts"
)
esp_dict_region_code(iso2vals,
origin = "iso2",
destination = "cpro"
)
# Mixing levels
valsmix <- c("Centro", "Andalucia", "Seville", "Menorca")
esp_dict_region_code(valsmix, destination = "nuts")
esp_dict_region_code(valsmix, destination = "codauto")
esp_dict_region_code(valsmix, destination = "iso2")
vals <- c("La Rioja", "Sevilla", "Madrid", "Jaen", "Orense", "Baleares")
esp_dict_translate(vals)
esp_dict_translate(vals, lang = "es")
esp_dict_translate(vals, lang = "ca")
esp_dict_translate(vals, lang = "eu")
esp_dict_translate(vals, lang = "ga")
esp_dict_translate(vals, lang = "ga", all = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.