Research question

How has the US gender wage gap changed over time for different occupations and age groups?

  • The US gender wage gap may be affecting you!

Data Sources

#reading in the data
jobs_gender <- readr::read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-03-05/jobs_gender.csv")
earnings_female <- readr::read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-03-05/earnings_female.csv") 
employed_gender <- readr::read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-03-05/employed_gender.csv") 

Data Dictionary for employed_gender, earnings_female, and jobs_gender is in the Appendix


Employment Rate

#full time compared to part time
employedfulltime_gender <- employed_gender %>%
  select(year,full_time_female, full_time_male) %>%
  rename(Female = full_time_female, Male = full_time_male) %>%
  gather(key = "gender", value = "fullTime", Female:Male) 
  

employedfulltime_gender %>%  
  ggplot(aes(x=year, y = fullTime, color = gender)) +
  geom_line(size = .5) +
  geom_text_repel(data = employedfulltime_gender %>%
                    filter(year == max(year)), aes(label = gender), hjust=0, nudge_x = 1, direction = "y", size = 4.5, segment.color = NA) +
  geom_point(size =.5) +
  scale_x_continuous(breaks = seq(1968,2016, 4),
                     expand = expansion(add = c(0,11))) +
  scale_y_continuous(breaks = seq(0,100,2)) +
  scale_color_manual(
      values = c('#D95F02', '#1B9E77')) +
  theme_half_open(font_size = 11) + 
  theme(legend.position = 'none') +
  geom_curve(
    data = data.frame(
      x = 1969, xend = 1969, y = 85, yend = 91.5),
    mapping = aes(x = x, xend = xend, y = y, yend = yend),
    color = 'black', size = 0.5, curvature = 0,
    arrow = arrow(length = unit(0.01, "npc"),
                  type = "closed")) +
  geom_smooth(se = FALSE, linetype = 'dashed', method = "lm")+
  geom_curve(
    data = data.frame(
      x = 1969, xend = 1969, y = 83.5, yend = 76),
    mapping = aes(x = x, xend = xend, y = y, yend = yend),
    color = 'black', size = 0.5, curvature = 0,
    arrow = arrow(length = unit(0.01, "npc"),
                  type = "closed")) +
  annotate(geom = 'text', x = 1975, y = 84,
             label = 'Difference of 17.1% in 1968', size = 3, color = 'black') +
  annotate(geom = 'text', x = 2017, y = 82,
            label = 'Difference of 12.5% in 2016', size = 3, color = 'black') +
  geom_curve(
    data = data.frame(
      x = 2017, xend = 2017, y = 82.5, yend = 87),
    mapping = aes(x = x, xend = xend, y = y, yend = yend),
    color = 'black', size = 0.5, curvature = 0,
    arrow = arrow(length = unit(0.01, "npc"),
                  type = "closed")) +
  geom_curve(
    data = data.frame(
      x = 2017, xend = 2017, y = 81, yend = 76),
    mapping = aes(x = x, xend = xend, y = y, yend = yend),
    color = 'black', size = 0.5, curvature = 0,
    arrow = arrow(length = unit(0.01, "npc"),
                  type = "closed"))+
  scale_y_continuous(labels = scales::percent_format(scale =1, accuracy = 1)) +
  labs(x = "Year", y = "Percent Employed Full-time by Gender ", title = "Trends of Genders Working Full Time")

# calculate the difference in 1968
# male = 92.2 female = 75.1 difference = 17.1

# calculate the difference in 2016
# male = 87.6 female = 75.1, difference = 12.5

After analyzing this chart, we decided to look into whether occupation or age group have a larger effect on the gap.


Wage Gap By Age Group

Not only is there an evident difference between the distribution of the percent of genders working full time, there is also a reflection of a gender difference in salary. The following chart, “Age Trends of Female Salary as a Percentage of Male Salary” shows female salaries as a percentage of male salaries. This chart shows that since 1979 the total trends of female salary as a percent of male salary for all ages has increased over time. In 1979, the female salary as a percentage of male was 62.3% and 80.9% in 2011. While this is an 18.6% increase, females are still not paid the same percentage as male. As of 2011, there is still a 19.1% gap .

agegroupearnings <- earnings_female %>%
  filter(group != "Total, 16 years and older")
totalearnings <-  earnings_female %>%
  filter(group == "Total, 16 years and older")

ggplot() +
  geom_line(data = agegroupearnings, aes(x=Year, y = percent, color = group), alpha = 0.45, size =.5) +
  geom_line(data = totalearnings, aes(x=Year, y = percent, color = group), alpha = 1.2, size =.7) +
  geom_text_repel(data = earnings_female %>%
                    filter(Year == max(Year)), aes(x= Year, y = percent, label = group, color = group), hjust=0, nudge_x = 1, direction = "y", size = 4.3, segment.color = NA) +
  scale_x_continuous(breaks = seq(1980,2011, 5),
                     expand = expansion(add = c(0,15.5))) +
  scale_y_continuous(labels = scales::percent_format(scale =1)) + 
  scale_color_brewer(palette="Dark2") +
  theme_half_open(font_size = 11) + 
  theme(legend.position = 'none') +
  labs(x= "Year", y = "Female salary percent of male salary", title = "Age Trends of Female Salary as a Percentage of Male Salary")