Learn R Programming

electionsBR (version 0.3.2)

seats_local: Download data on the number of seats under dispute in local elections

Description

seats_local() downloads and aggregates data on the number of seats under dispute in local elections in Brazil. The function returns a tbl, data.frame where each observation corresponds to a municipality office dyad.

Usage

seats_local(
  year,
  uf = "all",
  ascii = FALSE,
  encoding = "latin1",
  export = FALSE,
  temp = TRUE
)

Value

seats_local() returns a data.frame with the following variables:

  • DATA_GERACAO: Generation date of the file (when the data was collected).

  • HORA_GERACAO: Generation time of the file (when the data was collected), Brasilia Time.

  • ANO_ELEICAO: Election year.

  • DESCRICAO_ELEICAO: Description of the election.

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

  • SIGLA_UE: Units of the Federation's acronym (In case of major election is the FU's acronym in which the candidate runs for (text) and in case of municipal election is the municipal's Supreme Electoral Court code (number)). Assume the special values BR, ZZ and VT to designate, respectively, Brazil, Overseas and Absentee Ballot.

  • NOME_UE: Description of the Electoral Unit.

  • CODIGO_CARGO: Code of the position that the candidate runs for.

  • DESCRICAO_CARGO: Description of the position that the candidate runs for.

  • QTDE_VAGAS: number of seats under dispute.

Arguments

year

Election year. For this function, onlye the years of 1996, 2000, 2004, 2008, 2012, 2016 and 2020 are available.

uf

Federation Unit acronym (character vector).

ascii

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

encoding

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

export

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

temp

(logical). If TRUE, keep the temporary compressed file for future use (recommended)

Details

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

See Also

seats_fed for federal elections in Brazil.

Examples

Run this code
if (FALSE) {
df <- seats_local(2000)
}

Run the code above in your browser using DataLab