mayor: Extract data of Brazilian mayoral polls.

Description Usage Arguments Value Examples

View source: R/mayor.R

Description

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

Arguments

year

Election year (integer). Available years are 2000, 2004, 2008, 2012 and 2016.

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 mayoral 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 mayoral polls
# conducted in the 2016 elections
df <- mayor(2016)

# returns a data.frame with results for all polls in the
# secound round of the 2008 mayoral elections in all of
# Brazilian southeastern states.
df<- mayor(2008, state = c("ES", "MG", "RJ", "SP"), round = 2)

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