Skip to contents

Conversion the type of election (referendum, congress, etc) to a properly code (according to documentation) available in Spanish Ministry of Interior

Usage

type_to_code_election(type_elec)

Arguments

type_elec

Type elections for which data is available. It should be one of the following values: "referendum", "congress", "senate", "local", "cabildo" (Canarian council) or "EU".

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.

Author

Javier Alvarez-Liebana, David Pereiro-Pol, Mafalda Gonzalez-Gonzalez and Irene Bosque-Gala.

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")
} # }