president_state_vote() downloads, cleans, and transforms data on presidential elections results in the second round (runnoff elections) by state. The electoral results are, by default, reported as proportion

president_state_vote(year, prop = TRUE, ascii = FALSE,
  encoding = "Latin-1")



Election year (integer). For this function, only the years 2002, 2006, 2010, and 2014 are available.


Shoud the votes be reported as porportion? (Defaults to TRUE).


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


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


president_state_vote() returns a tbl, data.frame with the following variables:

  • ANO_ELEICAO: Election year.

  • SIGLA_UF: Unit of the Federation's acronym in which occurred the election.

  • SIGLA_PARTIDO: Party acronym.

  • NOME_PARTIDO: Party name.

  • NUMERO_PARTIDO: Party number.

  • NOME_COLIGACAO: Coalition shortname.

  • COMPOSICAO_LEGENDA: Party's shortname composition.

  • TOTAL_VOTOS: Party votos (or porportion) votes by state.


This functions includes results to BR and ZZ state acronyms: the first one considers the entire country as a district; the second one considers voters living abroad as a district. For 2014 elections, results are only available for these two state acronyms.

See also

president_mun_vote for presidential elections results by municipality; legislative_mun_vote for legislative elections results by municipality; and legislative_state_vote for legislative elections results by state.


df <- president_state_vote(2002)
# }