Learn R Programming

electionsBR (version 0.4.0)

elections_cepesp: Retrieve electoral data from the cepesp API.

Description

Retrieve electoral data from the cepesp API.

Usage

elections_cepesp(year, type, position, data_table = FALSE)

Value

The function returns a tibble containing the requested elections data.

Arguments

year

The election year. Valid options are between 1998 to 2018 for positions such as President, Governor, Senator, Federal Deputy, State Deputy, and District Deputy. For Mayor or Councillor positions, valid options range from 2000 to 2016.

type

The type of data to retrieve. Valid options are "candidate" or "vote".

position

The position for which the data is requested. Valid options are President, Governor, Senator, Federal Deputy, State Deputy, District Deputy, Mayor, or Councillor.

data_table

If set to TRUE, the function will return the data as a data.table object. Default is FALSE.

Examples

Run this code
if (FALSE) {
df <- elections_cepesp(2018, type = "candidate", position = "President")
}

Run the code above in your browser using DataLab