Skip to content

Instantly share code, notes, and snippets.

@MattCowgill
Created February 16, 2023 03:42
Show Gist options
  • Save MattCowgill/3390c974d614362b55dd0d6f01c1b28b to your computer and use it in GitHub Desktop.
Save MattCowgill/3390c974d614362b55dd0d6f01c1b28b to your computer and use it in GitHub Desktop.
library(readabs)
library(tidyverse)
ur <- read_abs_series("A84423050A") |>
select(date, ur = value)
dec_jan_moves <- ur |>
mutate(diff = ur - lag(ur, n = 1L, order_by = date)) |>
filter(month(date) == 1L) |>
mutate(is_latest = if_else(date == max(date), "Jan '23", "Other Januaries since 1979"))
ave_diff = mean(dec_jan_moves$diff)
dec_jan_moves |>
ggplot(aes(x = diff, fill = is_latest, col = is_latest)) +
geom_vline(xintercept = ave_diff) +
annotate("text", x = ave_diff, y = 0.95,
label = paste0("Mean: ", round(ave_diff, 2), " ppts"),
hjust = -0.1) +
ggdist::geom_dots(group = 1) +
theme_minimal(base_size = 18) +
scale_y_continuous(expand = expansion(c(0, 0.05))) +
theme(axis.text.y = element_blank(),
legend.position = "top",
legend.direction = "horizontal",
legend.title = element_blank(),
axis.title.y = element_blank()) +
labs(x = "Change in unemp rate between Dec and Jan (ppts)",
caption = "Note: Based on seasonally adjusted data.\nSource: ABS")
dec_jan_moves |>
mutate(is_latest = if_else(date == max(date), "Jan '23", "Other Januaries since 1979")) |>
ggplot(aes(x = year(date), y = diff, fill = is_latest, col = is_latest)) +
geom_col() +
theme_minimal(base_size = 18) +
scale_y_continuous(expand = expansion(c(0, 0.05))) +
theme(axis.title.x = element_blank(),
legend.position = "top",
legend.direction = "horizontal",
legend.title = element_blank(),
axis.title = element_blank()) +
labs(subtitle = "Change in unemp rate between Dec and Jan (ppts)",
caption = "Note: Based on seasonally adjusted data.\nSource: ABS")
@MattCowgill
Copy link
Author

image

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment