Code
library(tidyverse)
library(readr)
library(hrbrthemes)
Robert W. Walker
February 8, 2021
tidyTuesday for the week of February 8, 2021 brings data from the US Census and the Urban Institute together to think about income, wealth, and racial inequality in these and other important economic indicators. There is a lot of data that they make available to accompany the nine charts about wealth inequality that they reported here. There is considerable variation in the scope and coverage of the various datasets; I will start by loading the ten datasets.
lifetime_earn <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-02-09/lifetime_earn.csv')
student_debt <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-02-09/student_debt.csv')
retirement <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-02-09/retirement.csv')
home_owner <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-02-09/home_owner.csv')
race_wealth <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-02-09/race_wealth.csv')
income_time <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-02-09/income_time.csv')
income_limits <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-02-09/income_limits.csv')
income_aggregate <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-02-09/income_aggregate.csv')
income_distribution <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-02-09/income_distribution.csv')
income_mean <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-02-09/income_mean.csv')
There is not all that much data here. Six values for the cross-tabulation of race and gender.
Combining the categories offers a considerably improved visual in my view.
lifetime_earn %>%
mutate(Categ = paste(race,gender,sep=":")) %>%
ggplot() +
aes(x=Categ, y=lifetime_earn/1000000, fill=race, color=race, label=lifetime_earn/1000000, alpha=0.2) +
geom_col() + geom_text(size=3, color="white", alpha=1) +
coord_flip() + scale_color_ipsum() + scale_fill_ipsum() +
theme_modern_rc() +
labs(y="Lifetime Earnings [in millions]", x="Race:Gender") +
guides(fill=FALSE, color=FALSE, alpha=FALSE)
lifetime_earn %>%
mutate(Categ = paste(gender,race,sep=":")) %>%
ggplot() +
aes(x=Categ, y=lifetime_earn/1000000, fill=race, color=race, label=lifetime_earn/1000000, alpha=0.2) +
geom_col() + geom_text(size=3, color="white", alpha=1) +
coord_flip() + scale_color_ipsum() + scale_fill_ipsum() +
theme_modern_rc() +
labs(y="Lifetime Earnings [in millions]", x="Race:Gender") +
guides(fill=FALSE, color=FALSE, alpha=FALSE)
The student debt data is not super extensive. At three year intervals, we see growth across categories but higher levels and rates are notable by racial category. A line plot is a good place to start.
A faceted bar plot.
Liquid retirement savings offer an interesting basis for comparison.