knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

SenadoBR

lifecycle Build Status CRAN Version License

R package for accessing the Brazilian Senate RESTful API

Installation

To get the current development version from Github:

## install devtools package if it's not already
if (!requireNamespace("devtools", quietly = TRUE)) {
  install.packages("devtools")
}
## install dev version of SenadoBR from github
devtools::install_github("danielmarcelino/SenadoBR")

Usage

Get the actual list of senators

## load SenadoBR package
library(SenadoBR)

sents = fetchSenators()

print(sents)

Get bloc leaders

fetchGovBlocLeader(bloc="Governo")


fetchGovBlocLeader(bloc="Maioria")


fetchGovBlocLeader(bloc="Minoria")


fetchGovBlocLeader(bloc="Bloco")


fetchGovBlocLeader(bloc="PODE")

Get the list of rollcall votes

fetchRollcallVotesByInterval(initial_date = "01/02/2019")

Retrieve detailed information of a bill rollcall session

fetchRollcallVotes(bill_id = 135251)

Retrieve rollcall votes hisotry

# get detailed information from rollcalls carried out in the period:

infos <- fetchRollcallVotesByInterval(initial_date = "01/10/2020")


print(infos)
# then we can extract votes from "Mapa de votação nominal" archives

rollcalls = extractRollcallVotes(infos)


# Result 
rollcalls %>% 
  select(rollcall_id, datetime, legislator_name, legislator_party, legislator_vote)


danielmarcelino/SenadoBR documentation built on Oct. 15, 2020, 7:37 a.m.