esp_dict_region_code {mapSpain} | R Documentation |
Convert and translate subdivision names
Description
Converts long subdivision names into different coding schemes and languages.
Usage
esp_dict_region_code(sourcevar, origin = "text", destination = "text")
esp_dict_translate(sourcevar, lang = "en", all = FALSE)
Arguments
sourcevar |
Vector which contains the subdivision names to be converted. |
origin , destination |
One of |
lang |
Language of translation. Available languages are:
|
all |
Logical. Should the function return all names or not?
On |
Details
If no match is found for any value, the function displays a warning and
returns NA
for those values.
Note that mixing names of different administrative levels (e.g. "Catalonia"
and "Barcelona") may return empty values, depending on the destination
values.
Value
esp_dict_region_code()
returns a vector of characters.
esp_dict_translate()
returns a character
vector or a named list
with
each of the possible names of each sourcevar
on the required language
lang
.
See Also
Other dictionary:
esp_codelist
Other dictionary:
esp_codelist
Examples
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")
## Not run:
# Warning
esp_dict_region_code(valsmix, destination = "codauto")
esp_dict_region_code(valsmix, destination = "iso2")
## End(Not run)
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)