`candidatos()` downloads, formats and imports to the environment the data of the candidates from the electoral lists of the selected elections.

candidatos(tipo_eleccion, anno, mes, nivel)

Arguments

tipo_eleccion

The type of choice you want to download. The accepted values are "congreso", "senado", "europeas" o "municipales".

anno

The year of the election in YYYY format.

mes

The month of the election in MM format.

nivel

The administrative level for which the data is wanted ("mesa" for polling stations or "municipio" for municipalities). Only necessary when tipo_eleccion = "senado"

Value

data.frame with the candidates data. If tipo_eleccion = "senado" a column called `votos` is included with the votes recieved by each candidate. If other type of election is selected this column is not included since the votes are not received by the specific candidates but by the closed list of the party.

Examples

data <- candidatos(
  tipo_eleccion = "senado", anno = "2004",
  mes = "03", nivel = "municipio"
)
#> Downloading https://infoelectoral.interior.gob.es/estaticos/docxl/apliextr/03200403_MUNI.zip
str(data)
#> 'data.frame':	269807 obs. of  39 variables:
#>  $ tipo_eleccion            : chr  "03" "03" "03" "03" ...
#>  $ anno                     : chr  "2004" "2004" "2004" "2004" ...
#>  $ mes                      : chr  "03" "03" "03" "03" ...
#>  $ vuelta                   : chr  "1" "1" "1" "1" ...
#>  $ codigo_ccaa              : chr  "01" "01" "01" "01" ...
#>  $ codigo_provincia         : chr  "04" "04" "04" "04" ...
#>  $ codigo_distrito_electoral: chr  "0" "0" "0" "0" ...
#>  $ codigo_municipio         : chr  "001" "001" "001" "001" ...
#>  $ municipio                : chr  "Abla" "Abla" "Abla" "Abla" ...
#>  $ codigo_distrito          : chr  "99" "99" "99" "99" ...
#>  $ numero_mesas             : num  2 2 2 2 2 2 2 2 2 2 ...
#>  $ poblacion_derecho        : num  1480 1480 1480 1480 1480 1480 1480 1480 1480 1480 ...
#>  $ censo_ine                : num  1246 1246 1246 1246 1246 ...
#>  $ censo_escrutinio         : num  1246 1246 1246 1246 1246 ...
#>  $ censo_cere               : num  0 0 0 0 0 0 0 0 0 0 ...
#>  $ votantes_cere            : num  0 0 0 0 0 0 0 0 0 0 ...
#>  $ participacion_1          : num  550 550 550 550 550 550 550 550 550 550 ...
#>  $ participacion_2          : num  906 906 906 906 906 906 906 906 906 906 ...
#>  $ votos_blancos            : num  17 17 17 17 17 17 17 17 17 17 ...
#>  $ votos_nulos              : num  28 28 28 28 28 28 28 28 28 28 ...
#>  $ votos_candidaturas       : num  959 959 959 959 959 959 959 959 959 959 ...
#>  $ codigo_partido_nacional  : chr  "000098" "000098" "000098" "000024" ...
#>  $ codigo_partido_autonomia : chr  "000098" "000098" "000098" "000024" ...
#>  $ codigo_partido_provincia : chr  "000098" "000098" "000098" "000024" ...
#>  $ codigo_partido           : chr  "000098" "000098" "000098" "000024" ...
#>  $ denominacion             : chr  "denominacion" "denominacion" "denominacion" "denominacion" ...
#>  $ siglas                   : chr  "PA" "PA" "PA" "CDS" ...
#>  $ codigo_senador           : chr  "049001" "049002" "049003" "049004" ...
#>  $ orden_candidato          : num  1 2 3 4 5 6 7 8 9 10 ...
#>  $ tipo_candidato           : chr  "T" "T" "T" "T" ...
#>  $ nombre                   : chr  "ASCENSION" "JOSE LUIS" "FERNANDO MANUEL" "JUAN ANTONIO" ...
#>  $ apellido_1               : chr  "ARCAS" "ARTERO" "DE LA TORRE" "RODRIGUEZ" ...
#>  $ apellido_2               : chr  "GARCIA" "GARCIA" "RODRIGUEZ" "GILABERT" ...
#>  $ sexo                     : chr  "" "" "" "" ...
#>  $ nacimiento               : Date, format: "2024-09-03" "2024-09-03" ...
#>  $ dni                      : chr  "27525307B" "34861560T" "24132988P" "27531816B" ...
#>  $ votos                    : num  6 5 5 1 3 531 521 522 17 16 ...
#>  $ electo                   : chr  "N" "N" "N" "N" ...
#>  $ datos_oficiales          : chr  "S" "S" "S" "S" ...