Skip to content

Instantly share code, notes, and snippets.

@slowkow
Last active October 15, 2020 13:46
Show Gist options
  • Save slowkow/2251d7f2247ae80e0403314df4b312e3 to your computer and use it in GitHub Desktop.
Save slowkow/2251d7f2247ae80e0403314df4b312e3 to your computer and use it in GitHub Desktop.
Trends in Income From 1975 to 2018 by Carter C. Price, Kathryn A. Edwards
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# Trends in Income From 1975 to 2018
# by Carter C. Price, Kathryn A. Edwards
# We can download the PDF here and find Table 2.b:
# https://www.rand.org/pubs/working_papers/WRA516-1.html
library(tidyverse)
d <- read.delim(header = FALSE, sep = " ",
text =
"1975 $28,000 $42,000 $58,000 $77,000 $91,000 $257,000 $289,000
1979 $28,000 $42,000 $60,000 $82,000 $101,000 $226,000 $292,000
1989 $28,000 $43,000 $62,000 $88,000 $109,000 $349,000 $467,000
2000 $31,000 $47,000 $72,000 $109,000 $145,000 $830,000 $1,121,000
2007 $30,000 $46,000 $72,000 $115,000 $160,000 $1,058,000 $1,311,000
2018 $33,000 $50,000 $81,000 $133,000 $191,000 $761,000 $1,384,000
Counterfactual $61,000 $92,000 $126,000 $168,000 $198,000 $560,000 $630,000
"
)
for (i in 2:8) {
d[[i]] <- readr::parse_number(d[[i]])
}
colnames(d) <- c(
"year", "25th %", "Median", "75th %", "90th %", "95th %", "99th %", "Top 1% Mean"
)
d <- d %>% pivot_longer(-year)
d$name <- factor(
d$name,
c("25th %", "Median", "75th %", "90th %", "95th %", "99th %", "Top 1% Mean")
)
d$year_n <- as.numeric(d$year)
d$year_n[is.na(d$year_n)] <- 2020
ggplot(d %>% filter(year_n < 2020)) +
aes(year_n, value, group = name, color = name) +
geom_line(
size = 2
) +
scale_x_continuous(
breaks = c(1975, 1979, 1989, 2000, 2007, 2018)
) +
# scale_y_continuous(labels = scales::dollar) +
scale_y_log10(
labels = scales::dollar
) +
annotation_logticks(sides = "l") +
guides(
color = guide_legend(title = NULL, reverse = TRUE)
) +
theme_bw(base_size = 20) +
theme(panel.grid.minor = element_blank()) +
labs(x = NULL, y = NULL,
title = "Income Distribution",
subtitle = "for Full-Year, Full-Time, Prime-Aged Workers in 2018 Dollars",
caption = "Carter C. Price and Kathryn Edwards, RAND Corporation")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment