president: 'president()' extracts data of Brazilian presidential polls...

Description Usage Arguments Value Examples

View source: R/president.R

Description

president() extracts data of Brazilian presidential polls from the Poder 360's poll agreggator API (https://www.poder360.com.br/pesquisas-de-opiniao/api/). The function returns a data.frame where each observation corresponds to a candidate's estimate in a poll.

Usage

1
president(year, state = "ALL", round = c(1, 2), type = c(1, 2, 3))

Arguments

year

Election year (integer). The available years are 2002, 2006, 2010, 2014, 2018.

state

Initials in capital letters (character) of the state (if the poll was conducted only in state-level) or the country ("BR", if it was in national-level). Default returns all presidential polls for the corresponding election year.

round

Number (integer) corresponding to the election round that the poll corresponds. Default returns polls for both first and second rounds.

type

Number (character) indicating if the user wants the spontaneous (1), estimulated (2), or rejection (3) estimations of polls. Default returns all poll results.

Value

data.frame with results from polls conducted for presidential elections in Brazil, for the year specified, with the following variables:

Examples

1
2
3
4
5
6
7
8
# returns a data.frame with the results for all presidential polls conducted
# in the 2018 elections
df <- president(2018)

# returns a data.frame with results for all presidential polls conducted at
# the national-level for the first round of the 2018 elections with candidate's
# rejection estimates
df <- president(2018, state = "BR", round = 1, type = 3)

voltdatalab/pollingbr documentation built on April 1, 2021, 4:38 a.m.