Skip to content

Instantly share code, notes, and snippets.

@sbfnk
Last active April 3, 2023 19:09
Show Gist options
  • Save sbfnk/96588a8f89d0d61df8929ff943c0f6c2 to your computer and use it in GitHub Desktop.
Save sbfnk/96588a8f89d0d61df8929ff943c0f6c2 to your computer and use it in GitHub Desktop.
library("readr")
library("dplyr")
df <- readr::read_csv("https://raw.githubusercontent.com/epiforecasts/inc2prev/master/outputs/estimates_age_ab.csv") ## nolint
td <- df |>
dplyr::filter(name == "infections") |>
dplyr::select(t_index, date) |>
dplyr::distinct() |>
dplyr::arrange(t_index)
susc <- df |>
dplyr::filter(name == "gen_dab") |>
dplyr::select(t_index, age_group = variable, mean, q5, q25, q75, q95) |>
dplyr::left_join(td, by = "t_index") |>
dplyr::mutate(
age_group = dplyr::recode(age_group, `2-10` = "02-10")
) |>
dplyr::arrange(date, age_group)
readr::write_csv(susc, "age_susceptibility_covid.csv")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment