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

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



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


Shoud the votes be reported as proportion? (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_mun_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.

  • CODIGO_MUNICIPIO: Supreme Electoral code from the city where occurred the election.

  • NOME_MUNICIPIO: Name of the city where 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 total 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_state_vote for presidential elections results by state; legislative_mun_vote for legislative elections results by municipality; and legislative_state_vote for legislative elections results by state.


df <- president_mun_vote(2002)
# }