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 offers a set of functions to easily pull and clean Brazilian electoral data from the Brazilian Superior Electoral Court (TSE) 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 is on CRAN and can be installed with:
electionsBR is also available on GitHub. You can install pre-release versions via:
if (!require("devtools")) install.packages("devtools")devtools::install_github("silvadenisson/electionsBR")
To download data from a given election, only the
year argument must be passed to the function call:
library(electionsBR)df <- candidate_fed(year = 2002)
You may also export Brazilian electoral data to Stata and SPSS by setting the
export optional argument to
df <- candidate_fed(2002, export = TRUE)
As well as subset your results by state using the
df <- vote_mun_zone_fed(2002, uf = "RS")
For more information on how the package works and for a complete list of functions, see the vignette.
electionsBR in publications, please use:
We changed central aspects of the package, which affected all the functions in it (but without compromising backward compability). Beyond that, in this update we did our best to make the package more user friendly: we created a vignette, included more options to filter and customize functions' outputs, and added more specific functions (including one to easily export electoral data). With this new uptade, the package also gained a website. Overrall, this is what we did:
rbindlist()), (2) to make the package more robust to human errors (new internal functions to test inputs), and (3) to return a simples object (a dplyr
president_state_vote()) and by municipality (
legislative_state_vote()) and by municipality (
NEWS.mdfile to track changes to the package.
year = 2016option for local elections.
voter_affiliation, to collect dato on voters' affiliation.
voter_profile, to collect dato on voters' profile.
test_encoding, to validate encodings passed to the functions' calls.
messagein all functions. Users are now free to supress unwanted messages.