voter_affiliation() downloads and cleans data on voters' affiliation to Brazilian political parties by state. The function returns a data.frame where each observation corresponds to a voter.

voter_affiliation(party, uf, ascii = FALSE, encoding = "windows-1252",
  export = FALSE)

Arguments

party

character vector containing the acronym of the parties with an official record on TSE. Spaces in the name of some parties (i.g. PC do B) must be preserved.

uf

character vector containing the acronym of the states of the federation.

ascii

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

encoding

Data original encoding (defaults to 'windows-1252'). 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?

Value

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

  • DATA_DA_EXTRACAO: Generation date of the file (when the data was compilled).

  • HORA_DA_EXTRACAO: Generation date of the file (when the data was compilled), Brasilia time.

  • NUMERO_DA_INSCRICAO: Voter's electoral ID.

  • NOME_DO_FILIADO: Voter's name.

  • SIGLA_DO_PARTIDO: Voter's party acronym.

  • NOME_DO_PARTIDO: Voter's party name.

  • UF: State of the federation.

  • CODIGO_DO_MUNICIPIO: Municipality's Supreme Electoral Court code (number).

  • NOME_DO_MUNICIPIO: Municipality's name.

  • ZONA_ELEITORAL: Electoral zone number.

  • SECAO_ELEITORAL: Electoral section number.

  • DATA_DA_FILIACAO: Date when the voter registered her affiliation.

  • SITUACAO_DO_REGISTRO: Voter's register situation.

  • TIPO_DO_REGISTRO: Register type.

  • DATA_DO_PROCESSAMENTO: Generation date of the register (when the register was compilled).

  • DATA_DA_DESFILIACAO: Date of de-affiliation (when applicable).

  • DATA_DO_CANCELAMENTO: Date when the register was cancelled (when applicable).

  • DATA_DA_REGULARIZACAO: Date when the register was regularized (when applicable).

  • MOTIVO_DO_CANCELAMENTO: Justification used to cancel the register (when applicable).

Details

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

Note

Data on party affiliation is uptadet on a daily basis, therefore it may vary depending on the day it is collected.

Examples

not_run({ df <- voter_affiliation("PT", "DF") df <- voter_affiliation(c("PT", "PC do B"), "DF") df <- voter_affiliation(c("PT", "PC do B"), c("DF", "MG", "AL")) })