Written on

Filibusted: a look at cloture votes

Found in [R , data visualization , politics] by @awhstin on

library(tidyverse)
library(rvest)
library(awtools)

Once we have those packages loaded (or installed) and once you have followed the instructions found here we can get started with gathering data from the ACS api. The two variables we will be using are: B19013_001 which is the median household income, and B25105_001 which is the median monthly housing cost.

presidents <- read.csv('https://raw.githubusercontent.com/awhstin/Dataset-List/master/presidents.csv')

cloture <- read_html('https://www.senate.gov/legislative/cloture/clotureCounts.htm') %>%
  html_nodes('table') %>%
  html_table() %>%
  data.frame(.,stringsAsFactors = FALSE) %>%
  filter(Congress != 'Total') %>%
  mutate(Congress = as.numeric(Congress)) %>%
  gather(.,type,n,3:5)

cloture.spread<- cloture  %>%
  mutate(Years = strsplit(as.character(Years), "-")) %>%
  unnest(Years)

Once we have both of those and have calulcated our percents we need to prepare the map projection. Then join the map to the ACS data we gathered before. Before this happens I believe this is most likely an opportunity for improvement but in the interest of keeping this under an hour I decided to reuse code I have used before without really looking for better ways. If you have some suggestions feel free to drop them in the comments! Thanks.

I think it would be interesting to see where some of the highest percentages are so I want to isolate the top 25 areas by percent and use that data for the labels on our map.

Now we can put it all together!

ggplot(cloture,aes(Congress, n, fill=type)) +
  geom_bar(stat='identity') +
  geom_vline(xintercept = 91.5, color='#dedede', size=1, linetype='dashed') +
  a_flat_fill() +
  a_dark_theme() +
  labs(title='Filibusted: growth of cloture votes in US Congress',
       subtitle='The growth of filibusters, often indicated by cloture votes has increased since the laws
around them change in the 70s. Often cited as a bastion of bipartisan politics it is more likely
a symbol of hyper-partisan inaction.',
       caption='Data from:\nhttps://www.senate.gov/legislative/cloture/clotureCounts.htm'
       )

Clearly these counties are centered around some of the largest metropolitan areas that were mentioned in the article. Areas around Washington D.C., Los Angeles, New York City, Miami all have high housing costs as a percentage of the median household income. The original article mentions that the HUD (Department of Housing and Urban Development) describes housing a burden if it occupies more than 30% of your income.