Skip to content

Instantly share code, notes, and snippets.

@jkr216
Created September 24, 2021 17:43
Show Gist options
  • Save jkr216/49841fd0cda6933323023bb28bd00bf2 to your computer and use it in GitHub Desktop.
Save jkr216/49841fd0cda6933323023bb28bd00bf2 to your computer and use it in GitHub Desktop.
atlanta fed wage tracker
library(tidyverse)
library(readxl)
url <-
"https://www.atlantafed.org/-/media/documents/datafiles/chcs/wage-growth-tracker/wage-growth-data.xlsx"
destfile <- "wage_growth_data.xlsx"
curl::curl_download(url, destfile)
### Import and visualize
read_excel(destfile, sheet = "Average Wage Quartile",
skip = 2) %>%
rename(date = 1) %>%
slice(-1:-10) %>%
mutate(
across(where(is.character), as.numeric)
) %>%
pivot_longer(-date) %>%
mutate(date = ymd(date)) %>%
# filter(account == "Gross domestic product") %>%
arrange(desc(date)) %>%
filter(!str_detect(name, "eighted")) %>%
ggplot(aes(x = date, y = value, color = name)) +
geom_line() +
theme_minimal() +
labs(title = "Wage Growth by Wage Level",
subtitle = "12-month Moving Avg Median Wage Growth",
color = "Wage Level",
y = "",
x = "")
### Filter to just 2020-2021 and top bottom wage levels
read_excel(destfile, sheet = "Average Wage Quartile",
skip = 2) %>%
rename(date = 1) %>%
slice(-1:-10) %>%
mutate(
across(where(is.character), as.numeric)
) %>%
pivot_longer(-date) %>%
mutate(date = ymd(date)) %>%
# filter(account == "Gross domestic product") %>%
arrange(desc(date)) %>%
filter(!str_detect(name, "eighted"),
name %in% c("1st", "4th"),
date >= "2020-01-01") %>%
ggplot(aes(x = date, y = value, color = name)) +
geom_line() +
theme_minimal() +
labs(title = "Wage Growth by Wage Level",
subtitle = "Zoom in to 2020 and just top/bottom level",
color = "Wage Level",
y = "",
x = "")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment