Exploring the Brazilian Federal Senate

Robert McDonnell, Guilherme Duarte and Danilo Freire

2019-05-08

The API of the Brazilian Federal Senate can be explored with congressbr by searching for details on individual senators, commissions and votes, among other options.

congressbr can be installed by running:

install.packages("congressbr")

And then loaded with:

library(congressbr)

Votes

The voting behaviour of legislators is an area of great interest both inside and outside of academia. congressbr has the sen_votes() function, which returns a data frame of votes in the Senate. These are not necessarily nominal votes, as some may be secret votes. In this case, the API records whether the senator voted or not. The other variables in the data frame returned pertain to the time of the vote, its number, id, year, description and its result. Information on individual senators (their party, name, id, gender and state) is also returned. This function has an argument, binary, which if TRUE, transforms the recorded (nominal) votes from “Yes” to 1 and “No” to 0. This is handy if you want to use the wnominate, pscl or MCMCpack functions to run ideal point analyses, for example. Please note that dates are in “yyyymmdd” format.

sen_votes(date = "20160908")
## # A tibble: 486 x 17
##    vote_date           vote_time vote_round bill_id bill_number bill_type
##    <dttm>              <chr>          <dbl> <chr>   <chr>       <chr>    
##  1 2016-09-08 00:00:00 14:00              1 126544  00076       MSF      
##  2 2016-09-08 00:00:00 14:00              1 126544  00076       MSF      
##  3 2016-09-08 00:00:00 14:00              1 126544  00076       MSF      
##  4 2016-09-08 00:00:00 14:00              1 126544  00076       MSF      
##  5 2016-09-08 00:00:00 14:00              1 126544  00076       MSF      
##  6 2016-09-08 00:00:00 14:00              1 126544  00076       MSF      
##  7 2016-09-08 00:00:00 14:00              1 126544  00076       MSF      
##  8 2016-09-08 00:00:00 14:00              1 126544  00076       MSF      
##  9 2016-09-08 00:00:00 14:00              1 126544  00076       MSF      
## 10 2016-09-08 00:00:00 14:00              1 126544  00076       MSF      
## # … with 476 more rows, and 11 more variables: bill_year <chr>,
## #   bill_description <chr>, rollcall_id <chr>, vote_result <chr>,
## #   vote_secret <chr>, senator_id <chr>, senator_name <chr>,
## #   senator_vote <chr>, senator_gender <chr>, senator_party <chr>,
## #   senator_state <chr>

For convenience, we have included a dataset of all nominal votes in the Federal Senate from 1991 to early 2017, which can be accessed with data("sen_nominal_votes"). The dataset is only 38KB and can be loaded quickly on any computer.

If you want to know more about the results from the plenary in the Federal Senate for a specified date, you may also use the sen_plenary() function. As an example, you can retrieve information from the session of the 3rd of March 2016 with:

sen_plenary_result(date = "20160303")
## # A tibble: 9 x 17
##   bill_id bill  bill_type bill_number bill_year session_id session_number
##   <chr>   <chr> <chr>     <chr>       <chr>     <chr>      <chr>         
## 1 124978  "REQ… RQS       00116       2016      3719       21            
## 2 125012  "REQ… RQS       00127       2016      3719       21            
## 3 123432  PROJ… MPV       00693       2015      3719       21            
## 4 123467  "PRO… MPV       00696       2015      3719       21            
## 5 122838  "PRO… PLS       00555       2015      3719       21            
## 6 83503   "PRO… PRS       00084       2007      3719       21            
## 7 124453  "PRO… PRS       00061       2015      3719       21            
## 8 122690  "PRO… PEC       00110       2015      3719       21            
## 9 124879  "PRO… PDS       00006       2016      3719       21            
## # … with 10 more variables: session_date <dttm>, session_time <chr>,
## #   session_type <chr>, session_type_abbr <chr>, session_house <chr>,
## #   bill_house <chr>, bill_report <chr>, bill_details <chr>,
## #   bill_result <chr>, bill_sponsor <chr>

Senator info

Information on individual senators can be had with sen_senator_details(). This function returns the senator’s id, name, party and state, as well as information on his/her date of birth, place of birth, their mandates, and office information such as email and correspondence address. If the senator is a titular senator, information on his/her deputies (suplentes) is available with sen_senator_suplentes(). The senator’s votes can be had with sen_senator_votes(), and their mandates with sen_senator_mandates(). For information on absences and party affiliations, use sen_senator(). All of these functions use the senator’s id (with the id option). A data frame of all of these is available from the function sen_senator_list():

sen_senator_list()
## # A tibble: 81 x 17
##    id    name_full name_senator gender foto_url page_url office_email
##    <chr> <chr>     <chr>        <chr>  <chr>    <chr>    <chr>       
##  1 4981  Acir Mar… Acir Gurgacz Mascu… http://… http://… acir@senado…
##  2 5982  Alessand… Alessandro … Mascu… http://… http://… sen.alessan…
##  3 945   Alvaro F… Alvaro Dias  Mascu… http://… http://… alvarodias@…
##  4 5967  Angelo M… Angelo Coro… Mascu… http://… http://… sen.angeloc…
##  5 5529  Antonio … Antonio Ana… Mascu… http://… http://… antonio.ana…
##  6 751   Arolde d… Arolde de O… Mascu… http://… http://… sen.arolded…
##  7 5990  Carlos A… Carlos Viana Mascu… http://… http://… sen.carlosv…
##  8 470   Francisc… Chico Rodri… Mascu… http://… http://… sen.chicoro…
##  9 5973  Cid Ferr… Cid Gomes    Mascu… http://… http://… sen.cidgome…
## 10 739   Ciro Nog… Ciro Noguei… Mascu… http://… http://… ciro.noguei…
## # … with 71 more rows, and 10 more variables: party_abbr <chr>,
## #   id_mandate <chr>, state <chr>, status <chr>,
## #   num_legislature_first_term <chr>, first_term_start <dttm>,
## #   first_term_end <dttm>, num_legislature_second_term <chr>,
## #   second_term_start <dttm>, second_term_end <dttm>

Commissions and coalitions

There are certain legislative coalitions in the Senate, all of whom have unique id numbers in the API database. These numbers can be accessed with sen_coalitions().

A data frame of commissions (full name and abbreviation) can be obtained with data("commissions"). The sen_commissions() function returns a detailed dataframe of commissions, their ids, type, house and purpose. Commissions can be explored by type variable returned from this function. For example, the “cpi” type (Comissão de Inquérito Parlamentar, Parliamentary Inquiry Commission) can be used in the sen_commissions_type() function, which will return a data frame of commissions of the type specified.

Using the commission abbreviations, we can see which senators serve on the commission. One well-known commission is the Commission for the Constitution, Justice and Citizenship (Constituicao, Justica e Cidadania). Its abbreviation is “CCJ”:

data("commissions")
sen_commissions_senators(code = "CCJ")
## # A tibble: 47 x 6
##    commission commission_abbr senator_id senator_name senator_party
##    <chr>      <chr>           <chr>      <chr>        <chr>        
##  1 Comissao … CCJ             5523       Otto Alencar PSD          
##  2 Comissao … CCJ             4994       Eduardo Bra… MDB          
##  3 Comissao … CCJ             5973       Cid Gomes    PDT          
##  4 Comissao … CCJ             5942       Marcos do V… CIDADANIA    
##  5 Comissao … CCJ             5666       Major Olimp… PSL          
##  6 Comissao … CCJ             5561       Renilde Bul… PROS         
##  7 Comissao … CCJ             5967       Angelo Coro… PSD          
##  8 Comissao … CCJ             22         Esperidiao … PP           
##  9 Comissao … CCJ             5350       Jorginho Me… PR           
## 10 Comissao … CCJ             285        Marcio Bitt… MDB          
## # … with 37 more rows, and 1 more variable: senator_state <chr>

General Information

Parties

A list of the parties who have held seats in the Senate can be had with sen_parties():

## # A tibble: 48 x 4
##    party_id party_abbr party_name                       date_created
##    <chr>    <chr>      <chr>                            <chr>       
##  1 578      AVANTE     AVANTE                           2017-09-12  
##  2 41       CIDADANIA  CIDADANIA                        1992-01-01  
##  3 581      DC         Democracia Crista                2018-05-18  
##  4 554      DEM        Democratas                       2007-03-28  
##  5 33       MDB        Movimento Democratico Brasileiro 1980-01-01  
##  6 566      NOVO       Partido Novo                     2015-09-15  
##  7 142      PAN        Partido dos Aposentados da Nacao 1998-02-19  
##  8 579      PATRI      Patriota                         2018-04-26  
##  9 94       PCB        Partido Comunista Brasileiro     1922-03-25  
## 10 144      PCN        Partido Comunitario  Nacional    1985-07-01  
## # … with 38 more rows

States

For some functions, there are options to narrow the search by focusing on certain states. If you are not familiar with all of the Brazilian states or with their commonly-used abbreviations, use the UF() function to print out a list of these abbreviations. For the full names of the states and their abbreviations, use data("statesBR").

##  [1] "AC" "AL" "AP" "AM" "BA" "CE" "DF" "ES" "GO" "MA" "MT" "MS" "MG" "PA"
## [15] "PB" "PR" "PE" "PI" "RJ" "RN" "RS" "RO" "RR" "SC" "SP" "SE" "TO"

Bill types

The Senate API can be queried by the type of bill. If you are not familiar with the types of bills that come to the Senate floor, use sen_bills_types(). Other similar functions, useful for getting to know the Senate, are sen_plenary_sessions(), which returns data on the types of sessions held in the Senate, sen_bills_topics(), which returns a data frame with the topic labels for different subject categories.

The bill types can be used for other queries, such as for seeing what bills of a certain type are currently passing through the house. For example, we can see which MPVs (medida provisória; executive decree) were under consideration in the Senate in 2001:

## # A tibble: 49 x 4
##    bill_id bill_number bill_year bill_type
##    <chr>   <chr>       <chr>     <chr>    
##  1 48017   02162       2001      MPV      
##  2 48018   02163       2001      MPV      
##  3 48019   02167       2001      MPV      
##  4 48020   02170       2001      MPV      
##  5 48021   02172       2001      MPV      
##  6 48022   02173       2001      MPV      
##  7 48025   02189       2001      MPV      
##  8 48032   02161       2001      MPV      
##  9 48034   02165       2001      MPV      
## 10 48036   02190       2001      MPV      
## # … with 39 more rows

This function can also be used to get information for a single date.

congressbr also has functions for accessing budget information (sen_budget()), and the agenda in the Senate for a particular date, or range of dates:

## # A tibble: 87 x 12
##    agenda_id agenda_title agenda_name agenda_type agenda_date        
##    <chr>     <chr>        <chr>       <chr>       <dttm>             
##  1 5551      CCS, as 09h… Reuniao de… Reuniao     2016-11-07 00:00:00
##  2 5537      CDH, as 10h… Audiencia … Extraordin… 2016-11-07 00:00:00
##  3 5553      CCS, as 14h… Reuniao de… Reuniao     2016-11-07 00:00:00
##  4 5576      CJD, as 14h… Audiencia … Reuniao     2016-11-07 00:00:00
##  5 5591      CDH, as 15h… Audiencia … Extraordin… 2016-11-07 00:00:00
##  6 5563      CCT, as 08h… Audiencia … Extraordin… 2016-11-08 00:00:00
##  7 5535      CDH, as 09h… Audiencia … Extraordin… 2016-11-08 00:00:00
##  8 5578      CMA, as 09h… Deliberati… Extraordin… 2016-11-08 00:00:00
##  9 5598      CCJ,CAE, as… Audiencia … Conjunta    2016-11-08 00:00:00
## 10 5581      CTG, as 11h… <NA>        Extraordin… 2016-11-08 00:00:00
## # … with 77 more rows, and 7 more variables: agenda_time <chr>,
## #   agenda_status <chr>, agenda_place <chr>,
## #   agenda_commission_house <chr>, agenda_commission_abbr <chr>,
## #   agenda_commission_id <chr>, agenda_commission_meeting_number <chr>

Examples

congressbr can be used for various types of analyses. As a quick example, let’s explore the distribution of men and women currently sitting in the house. (This example makes use of the ggplot2 package.)

Looking at the distribution of Titular senators and deputies (suplentes) is also straightforward:

Which states have the most suplentes?

## # A tibble: 4 x 2
##   state totals
##   <chr>  <int>
## 1 AC         1
## 2 AL         1
## 3 GO         1
## 4 RN         1

Mato Grosso, it seems, with two-thirds of their senators being stand-in suplentes.