Created
February 16, 2024 04:27
-
-
Save MattCowgill/0d096653af914f613a2fd7e8519f91c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(readabs) | |
library(tidyverse) | |
gf_cur <- read_lfs_grossflows("current") | |
gf_prev <- read_lfs_grossflows("previous") | |
ur_incoming <- gf_cur |> | |
filter(lfs_previous == "Incoming rotation group") |> | |
group_by(lfs_current, date) |> | |
summarise(value = sum(persons)) |> | |
pivot_wider(names_from = lfs_current) |> | |
mutate(ur = Unemployed / (`Employed full-time` + `Employed part-time` + `Unemployed`)) |> | |
select(date, ur) |> | |
mutate(series = "incoming") | |
ur_outgoing <- gf_prev |> | |
filter(lfs_current == "Outgoing rotation group") |> | |
group_by(lfs_previous, date) |> | |
summarise(value = sum(persons)) |> | |
pivot_wider(names_from = lfs_previous) |> | |
mutate(ur = Unemployed / (`Employed full-time` + `Employed part-time` + `Unemployed`)) |> | |
select(date, ur) |> | |
mutate(series = "outgoing") | |
ur <- ur_incoming |> | |
bind_rows(ur_outgoing) |> | |
pivot_wider(names_from = series, | |
values_from = ur) |> | |
mutate(diff = incoming - outgoing, | |
abs_diff = abs(diff)) | |
ur |> | |
mutate(pctile = percent_rank(abs_diff)) |> | |
filter(date == max(date)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment