Conversion the type of election (referendum, congress, etc) to a properly code (according to documentation) available in Spanish Ministry of Interior
Source
Data extracted from https://infoelectoral.interior.gob.es/opencms/es/elecciones-celebradas/area-de-descargas/
Value
A vector of string codes (cod_elec
) as follows:
"01"
: referendum."02"
: congress."03"
: senate."04"
: local elections."06"
: cabildo - Canarian council - elections)."07"
: European Parlament elections.
Examples
## Correct examples
type_to_code_election(type_elec = "congress")
#> [1] "02"
type_to_code_election(type_elec = "senate")
#> [1] "03"
type_to_code_election(type_elec = "local")
#> [1] "04"
# ----
# Incorrect examples
# ----
if (FALSE) { # \dontrun{
type_to_code_election(type_elec = "hi!")
type_to_code_election(type_elec = "nop")
type_to_code_election(type_elec = "national")
} # }