R Functions to Download and Clean Brazilian Electoral Data

Offers a set of functions to easily download and clean Brazilian electoral data from the Superior Electoral Court website. Among others, the package retrieves data on local and federal elections for all positions (city councilor, mayor, state deputy, federal deputy, governor, and president) aggregated by state, city, and electoral zones.


electionsBR contains a set of functions that automatically downloads and aggregates election data from Brazil (1996-2014), directly from the Brazilian Superior Electoral Court website (TSE). Among others, there are data available on local and federal elections for all positions (city councillor, mayor, state deputy, federal deputy, governor, and president) disaggregated by state of the Federation, city, zone, and polling stations. For the time being, electionsBR is only available at GitHub. You can install this pre-release version via:

if (!require("devtools")) install.packages("devtools")

electionsBR provides ten main functions to dowload and clean Brazilian electoral data:

  • candidate_fed()
  • candidate_local()
  • details_mun_zone_fed()
  • details_mun_zone_local()
  • legend_fed()
  • legend_local()
  • party_mun_zone_fed()
  • party_mun_zone_local()
  • vote_mun_zone_fed()
  • vote_mun_zone_local()

To download all the data from a given election, only the year argument must be passed to the function call:

df <- candidate_fed(year = 2002)

Denisson Silva, Fernando Meireles, and Beatriz Costa.

GPL (>= 2)


Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.3.0 by Denisson Silva, 6 months ago


Report a bug at https://github.com/silvadenisson/electionsBR/issues

Browse source code at https://github.com/cran/electionsBR

Authors: Denisson Silva [aut, cre], Fernando Meireles [aut], Beatriz Costa [ctb]

Documentation:   PDF Manual  

GPL (>= 2) license

Imports magrittr, dplyr, data.table, haven, stats

Suggests knitr, rmarkdown

See at CRAN