README.md

uspoliticalextras

US political open source data & resources – an R data package

A simple cache of US political data, collated from resources available on Git Hub & elsewhere. Big thanks to the folks at MIT Election Data and Science Lab, Civil Services, the Daily Kos & tidycensus for maintaining and making publically available these lovely resources!

I have simply aggregated these sources as an R package out of convenience, making minor adjustments in data structure and column names to facilitate joining among data sets.

Installation

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

Usage

Election returns

uspoliticalextras::uspol_medsl_returns_house_cd %>% select(year,GEOID, totalvotes:party)
## # A tibble: 9,556 x 9
##     year GEOID totalvotes democrat independent other republican candidate  party
##    <dbl> <chr>      <int>    <dbl>       <dbl> <dbl>      <dbl> <chr>      <chr>
##  1  1976 0101      157170     37.5        0     0          62.5 EDWARDS, … Repu…
##  2  1976 0102      156362     42.4        0     0          57.6 DICKINSON… Repu…
##  3  1976 0103      108048     99.0        0     1.03        0   NICHOLS, … Demo…
##  4  1976 0104      176022     80.4        0     0          19.6 BEVILL, T… Demo…
##  5  1976 0105      113560    100.         0     0           0   FLIPPO, R… Demo…
##  6  1976 0106      162518     42.7        0     0          56.7 BUCHANAN,… Repu…
##  7  1976 0107      110501    100          0     0           0   FLOWERS, … Demo…
##  8  1976 0200      118208     28.9        0     0          70.8 YOUNG, Do… Repu…
##  9  1976 0401      168119     40.7        0.62  1.35       57.3 RHODES, J… Repu…
## 10  1976 0402      182128     58.2        0     2.37       39.4 UDALL, Mo… Demo…
## # … with 9,546 more rows

Lawmaker biographical data

Lawmaker biographies via Civil Service. I have cleaned things up some, and eliminated some columns that are generally not useful to me. I have also joined icpsr values to facilitate joining with output from the Rvoteview package.

colnames(uspoliticalextras::uspol_csusa_house_bios)
##  [1] "congress"       "chamber"        "icpsr"          "state_fips"    
##  [5] "state"          "state_abbrev"   "district_code"  "bioguide_id"   
##  [9] "party"          "first_name"     "last_name"      "gender"        
## [13] "ethnicity"      "religion"       "date_of_birth"  "entered_office"
## [17] "term_end"       "biography"      "twitter_handle"

File structure:

uspoliticalextras::uspol_csusa_house_bios
## # A tibble: 870 x 19
##    congress chamber icpsr state_fips state state_abbrev district_code
##       <dbl> <chr>   <int>      <int> <chr> <chr>                <int>
##  1      115 House   21376          1 Alab… AL                       1
##  2      115 House   21192          1 Alab… AL                       2
##  3      115 House   20301          1 Alab… AL                       3
##  4      115 House   29701          1 Alab… AL                       4
##  5      115 House   21193          1 Alab… AL                       5
##  6      115 House   21500          1 Alab… AL                       6
##  7      115 House   21102          1 Alab… AL                       7
##  8      115 House   14066          2 Alas… AK                       0
##  9      115 House   21739          4 Ariz… AZ                       1
## 10      115 House   21501          4 Ariz… AZ                       2
## # … with 860 more rows, and 12 more variables: bioguide_id <chr>, party <chr>,
## #   first_name <chr>, last_name <chr>, gender <chr>, ethnicity <chr>,
## #   religion <chr>, date_of_birth <date>, entered_office <date>,
## #   term_end <date>, biography <chr>, twitter_handle <chr>

Equal-area polygons

names(uspol_dkos_equalarea_sf)
## [1] "tile_inner" "tile_outer" "hex_cds"    "hex_states"

Congressional district demographic profiles

American Community Survey variables included in the profile include:

unique(uspoliticalextras::uspol_dems2017_house$variable)
##  [1] "Median_HH_Income"          "Per_BachelorsHigher"      
##  [3] "Per_BachelorsHigher_White" "Per_Black"                
##  [5] "Per_clf_unemployed"        "Per_ForeignBorn"          
##  [7] "Per_Hispanic"              "Per_LessHS"               
##  [9] "Per_LessHS_White"          "Per_VotingAge"            
## [11] "Per_White"                 "CD_AREA"

File structure:

uspoliticalextras::uspol_dems2017_house
## # A tibble: 5,232 x 6
##    GEOID state_fips district_code state_abbrev variable         estimate
##    <chr>      <int>         <int> <chr>        <chr>               <dbl>
##  1 0101           1             1 AL           Median_HH_Income    47984
##  2 0102           1             2 AL           Median_HH_Income    46579
##  3 0103           1             3 AL           Median_HH_Income    46484
##  4 0104           1             4 AL           Median_HH_Income    43218
##  5 0105           1             5 AL           Median_HH_Income    54707
##  6 0106           1             6 AL           Median_HH_Income    65170
##  7 0107           1             7 AL           Median_HH_Income    35988
##  8 0200           2             0 AK           Median_HH_Income    73181
##  9 0401           4             1 AZ           Median_HH_Income    50303
## 10 0402           4             2 AZ           Median_HH_Income    53516
## # … with 5,222 more rows


jaytimm/uspoliticalextras documentation built on March 17, 2020, 3:44 a.m.