Unions in America

Below, you’ll find some code and graphical output that sheds some light on the state of the American labor movement. Specifically, this will give a good snapshot on the relative strength of the labor movement, broken down by public and private sector, and compared across all 50 states. All data is from Barry T. Hirsch and David A. Macpherson, “Union Membership and Coverage Database from the Current Population Survey: Note,” Industrial and Labor Relations Review, Vol. 56, No. 2, January 2003, pp. 349-54. (PDF).

It’s probably good to keep on eye on this data going forward, as recent attacks (cough Janus cough) and counterattacks (Liberal state pro-union legislation & the growing frequency of strikes) have increased, which may cause significant change in this data.

So, let’s start with producing one of my favorite types of data visualation: bubble graphs. Not just any bubble graph though, a multifaceted bubble graph!

Here’s the code to make it:

library(rmarkdown)
library(tidyverse)
library(ggthemes)
library(ggrepel)

options(tigris_use_cache = TRUE)

union_data <- read.csv("https://www.nickwarino.com/s/unions_states.csv",stringsAsFactors=F)

union_data_2015 <- union_data %>% filter(Year=="2015")

union_data_2015_private <- union_data %>% filter(Year=="2015", Sector=="Private")

union_data_2015_public <- union_data %>% filter(Year=="2015", Sector=="Public")

union_data_pub_pri <- full_join(union_data_2015_private, union_data_2015_public, by=c("State"="State"), suffix = c("_private", "_public"))
 
union_data_members_2015 <-union_data_pub_pri %>% select(State, Members_private, PctMem_private, Members_public, PctMem_public)

union_data_members_2015 <- union_data_members_2015 %>% mutate(total_members=Members_private+Members_public)
  
union_copy <- union_data_members_2015 %>% select(-State)

ggplot(data=union_data_members_2015,
       aes(x=PctMem_private,
           y=PctMem_public,
           color=State,
           size=total_members,
           alpha=0.40))+
  geom_point(data=union_copy, color="grey", alpha=0.40) +
  geom_point() +
  facet_wrap(~State) +
  theme_light() +
  theme(legend.position = "none") +
  scale_x_continuous(breaks=seq(0,20,5), limits=c(1,20)) +
  scale_y_continuous(breaks=seq(0,80,20), limits=c(1,80)) +
  labs(x="Private Sector Union Density (%)", y="Public Sector Union Density (%)", size="Total Membership", 
       title="Union Membership in the United States (2015)", 
       subtitle="The % of the public and private sector workers that belong to unions, and total membership", 
       caption="Created by Nick Warino | Data: Barry T. Hirsch and David A. Macpherson, 2003")

Now time for an interactive map.

Due to the Janus ruling against public sector unions, and my general interest in the public sector, I was more interested in public sector density than private. So for the map I’m only using public sector density, which requires extracting just that from the union database from above.

I then had to kiad the right US map shapefile, using the Tigris funcion geo_join to bring together the shapefile and the right database, joined by state name.

Then created the pop_up text and put it all together with the leaflet function.

library(readr)
library(dplyr)
library(ggplot2)
library(tidyr)
library(ggmap)
library(DT)
library(knitr)
library(tigris)
library(leaflet)

union_data <- read.csv("https://www.nickwarino.com/s/unions_states.csv",stringsAsFactors=F)

union_data_2015 <- union_data %>% filter(Year=="2015")

union_data_2015_public <- union_data %>% filter(Year=="2015", Sector=="Public")

states <- states(cb=T)

states_merged_pud <- geo_join(states, union_data_2015_public, "NAME", "State")

pal <- colorNumeric("Reds", domain=states_merged_pud$PctMem)

states_merged_pud <- subset(states_merged_pud, !is.na(PctMem))

# Setting up the pop up text
popup_pud <- paste0(as.character(states_merged_pud$NAME),"<br />Public Sector <br />Union Density: <br />",as.character(states_merged_pud$PctMem),"%<br /> (% of overall workforce <br />belong to a union)")

# Mapping it with the new tiles CartoDB.Positron
leaflet() %>%
  addProviderTiles("CartoDB.Positron") %>%
  setView(-98.483330, 38.712046, zoom = 4) %>% 
  addPolygons(data = states_merged_pud , 
              fillColor = ~pal(states_merged_pud$PctMem), 
              fillOpacity = 0.7, 
              weight = 0.2, 
              smoothFactor = 0.2, 
              popup = ~popup_pud) %>%
  addLegend(pal = pal, 
            values = states_merged_pud$PctMem,
            position = "bottomright", 
            title = "% of public sector workers <br />who are union members")