Skip to content
Voting roll calls for the 53rd Congress of the New Mexico State Legislature
Branch: master
Clone or download
Latest commit e3caec0 Nov 21, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R re Oct 2, 2018
data-raw re Nov 21, 2018
data re Oct 2, 2018
figure-markdown_github re Nov 21, 2018
man add Motion Oct 2, 2018
nmsl_tables re Oct 2, 2018
.Rbuildignore amend color palette Jun 27, 2018
.gitignore first Jun 17, 2018
DESCRIPTION re Jun 18, 2018
NAMESPACE re Oct 2, 2018
README.md re Nov 21, 2018
nmlegisdatr.Rproj first Jun 17, 2018

README.md

nmlegisdatr

An R Package for the New Mexico State Legislature

This package provides access to data about the 53rd New Mexico State Legislature, including roll call data, bill details, state legislator information, and some high-level characterizations of legislator voting patterns. Data included in the package have been scraped from thousands of PDFs made available via the official site of the New Mexico State Legislature. A full code-through of the scraping & summary processes is available here.

Many of these data (as well as roll call data for previous legislatures) are available via the Open:States project (github & website), which scrapes and makes available legislative data for all US state legislatures. The package presented here provides a softer (and slightly more labor-intensive) touch to the scraping process, including numerous hand edits and the standardization of bill and legislator naming conventions, for a cleaner and more New Mexico-centric collection of tables.

Installation

library(devtools)
devtools::install_github("jaytimm/nmlegisdatr")
library(nmlegisdatr)

Usage

The package contains six data tables; their contents are summarized in the table below.

Table Contents
nml_legislation All introduced legislation, including bill id, title, and bill description
nml_legislators All legislators in both chambers, including party affiliation and legislative district
nml_rollcall Roll calls for all legislation reaching either chamber for vote
nml_sponsors Sponsors for each bill
nml_rollcall_results Roll call results, including results disaggregated by political affiliation
nml_legislator_descs Votes cast, atttendance rates, and party loyalty rates for all legislators

Tables can also be viewed as a collection of CSVs or as individual tabs in a single Excel file.

The package includes two functions to perform simple searches across these tables. The first function, nml_get_legislation, provides a summary of bill details, legislative activity, and roll call results for a given piece of legislation. Search parameters include the year, session, bill, and chamber.

bill <- nmlegisdatr::nml_get_bill(year = '2017',
                                  session = 'Regular',
                                  bill = 'HB0527', 
                                  chamber = 'Senate') #Need to add 'motion'

The function returns a list of seven objects:

bill
## $Title
## [1] "MEDICAL MARIJUANA CHANGES"
## 
## $Sponsors
## # A tibble: 1 x 4
##   Chamber District Representative Party
##   <chr>   <chr>    <chr>          <chr>
## 1 House   30       GENTRY         Rep  
## 
## $Description
## # A tibble: 1 x 1
##   `R17_HB0527: MEDICAL MARIJUANA CHANGES`                         
##   <chr>                                                           
## 1 AN ACT RELATING TO THE PUBLIC PEACE, HEALTH, SAFETY AND WELFARE.
## 
## $Motion
## [1] "Passage"
## 
## $Result
## [1] "28-9"
## 
## $Actions
## # A tibble: 8 x 1
##   Actions                                 
##   <chr>                                   
## 1 [6] not prntd-HRC- w/drn - ref HHHC-HHHC
## 2 [10] DNP-CS/DP                          
## 3 [12] fl/a- PASSED/H (45-16)             
## 4 [26] SPAC/SJC-SPAC                      
## 5 [31] DP/a-SJC                           
## 6 [32] DP                                 
## 7 [33] PASSED/S (28-9)                    
## 8 [13] h/cncrd VETO.                      
## 
## $Vote
## # A tibble: 4 x 2
##   Party_Member_Vote Count
##   <fct>             <int>
## 1 Dem: Yea             21
## 2 Rep: Yea              7
## 3 Rep: Nay              9
## 4 Dem: Not Voting       5
## 
## $Rollcall
## # A tibble: 42 x 6
##    Chamber District Representative Party Member_Vote Party_Member_Vote
##    <chr>   <chr>    <chr>          <chr> <chr>       <fct>            
##  1 Senate  1        SHARER         Rep   Nay         Rep: Nay         
##  2 Senate  2        NEVILLE        Rep   Yea         Rep: Yea         
##  3 Senate  3        PINTO          Dem   Excused     Dem: Not Voting  
##  4 Senate  4        MUÑOZ          Dem   Yea         Dem: Yea         
##  5 Senate  5        MARTINEZ       Dem   Excused     Dem: Not Voting  
##  6 Senate  6        CISNEROS       Dem   Yea         Dem: Yea         
##  7 Senate  7        WOODS          Rep   Nay         Rep: Nay         
##  8 Senate  8        CAMPOS         Dem   Yea         Dem: Yea         
##  9 Senate  9        SAPIEN         Dem   Yea         Dem: Yea         
## 10 Senate  10       GOULD          Rep   Yea         Rep: Yea         
## # ... with 32 more rows

The second search function, nml_get_legislator, provides voting record details for a given legislator. Search parameters include legislator and chamber.

leg <- nmlegisdatr::nml_get_legislator(legislator='SHARER', 
                                       chamber = 'Senate')

The function returns a list of three data frames:

leg
## $Legislator
## # A tibble: 1 x 9
##   Congress Chamber Representative District Party First_elected Rep_Full   
##   <chr>    <chr>   <chr>          <chr>    <chr> <chr>         <chr>      
## 1 53       Senate  SHARER         1        Rep   2000          William E.~
## # ... with 2 more variables: Rep_Last <chr>, Rep_First <chr>
## 
## $Descriptives
## # A tibble: 3 x 4
##   Var           SHARER Median_Senate_Rep Median_Senate
##   <chr>         <chr>  <chr>             <chr>        
## 1 Votes_Cast    694    672               670.5        
## 2 Party_Loyalty 91.4%  93.15%            96.8%        
## 3 Attendance    97.5%  96.8%             97.5%        
## 
## $Voting_Record
## # A tibble: 728 x 6
##    Chamber Bill_Code  Motion  Party_Vote Member_Vote Result
##    <chr>   <chr>      <chr>   <chr>      <chr>       <chr> 
##  1 Senate  R17_HB0001 Passage Yea        NAY         35-5  
##  2 Senate  R17_HB0002 Passage Yea        NAY         33-8  
##  3 Senate  R17_HB0004 Passage Yea        Yea         40-0  
##  4 Senate  R17_HB0005 Passage Yea        Yea         40-1  
##  5 Senate  R17_HB0008 Passage Yea        Yea         39-0  
##  6 Senate  R17_HB0009 Passage Yea        Yea         36-0  
##  7 Senate  R17_HB0012 Passage Yea        Yea         30-0  
##  8 Senate  R17_HB0015 Passage Yea        Yea         40-0  
##  9 Senate  R17_HB0024 Passage Yea        Yea         40-0  
## 10 Senate  R17_HB0029 Passage Yea        Yea         35-1  
## # ... with 718 more rows
You can’t perform that action at this time.