Skip to contents

Retrieve electoral data from the cepesp API.

Usage

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

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.

Value

The function returns a tibble containing the requested elections data.

Note

The function is a wrapper for the cepesp API. To learn more about the API, please visit cepespdata.io.

Examples

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