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.

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



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


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


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


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


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.


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


not_run({ df <- voter_profile(2002) })