senator: Extract data of Brazilian senatorial polls.

Description Usage Arguments Value Examples

View source: R/senator.R

Description

senator() extracts data of Brazilian senatorial 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
senator(year, state = "ALL", type = c(1, 2, 3))

Arguments

year

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

state

Initials in capital letters (character) of the state election polled. Default returns all senatorial polls for the corresponding election year.

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 senatorial elections in Brazil, for the year specified, with the following variables:

Examples

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

# returns a data.frame with results for all polls for the first round of 2014
# Pernambuco's senatorial elections with candidates' rejection estimates
df <- senator(2014, state = "PE", type = 3)

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