voter_affiliation: Download data on voters' affiliation to political parties

Description Usage Arguments Details Value Note Examples

View source: R/voter_affiliation.R

Description

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.

Usage

1
2
3
4
5
6
7
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?

Details

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

Value

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

Note

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

Examples

1
2
3
4
5
6
7
8
## 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"))

## End(Not run)

electionsBR documentation built on Jan. 30, 2021, 5:06 p.m.