Learn R Programming

electionsBR (version 0.3.2)

voter_profile: Download data on the voters' profile

Description

voter_profile() downloads and cleans data on the voters' profile aggregated by state, city and electoral zone. The function returns a data.frame where each observation corresponds to a voter profile type.

Usage

voter_profile(
  year,
  ascii = FALSE,
  encoding = "windows-1252",
  export = FALSE,
  temp = TRUE
)

Value

voter_profile() returns a data.frame with the following variables:

  • PERIODO: Election year.

  • UF: Units of the Federation's acronym in which occurred the election.

  • MUNICIPIO: Municipality name.

  • COD_MUNICIPIO_TSE: Municipal's Supreme Electoral Court code (number).

  • NR_ZONA: Electoral zone's Supreme Electoral Court code (number).

  • SEXO: Voters' sex.

  • FAIXA_ETARIA: Voters' age group.

  • GRAU_DE_ESCOLARIDADE: Voters' education degree.

  • QTD_ELEITORES_NO_PERFIL: Absolute number of voters.

Arguments

year

Election year (integer). For this function, the following years are available: 1994, 1996, 1998, 2000, 2002, 2004, 2006, 2008, 2010, 2012, 2014, 2016, 2018 and 2020.

ascii

(logical). Should the text be transformed from Latin-1 to ASCII format?

encoding

Data original encoding (defaults to 'windows-1252'). This can be changed to avoid errors when ascii = TRUE.

export

(logical). Should the downloaded data be saved in .dta and .sav in the current directory?

temp

(logical). If TRUE, keep the temporary compressed file for future use (recommended)

Details

If export is set to TRUE, the downloaded data is saved as .dta and .sav files in the current directory.

Examples

Run this code
if (FALSE) {
df <- voter_profile(2002)
}

Run the code above in your browser using DataLab