library(dplyr)
source("data-raw/helpers.R")
raw <- read.csv(url("https://s3.amazonaws.com/quartzdata/datasets/influenza-burden.csv"))
raw %>%
subset(age_group != "All ages") -> tmp
# save 0-4 and 5-17 to later be re added
tmp %>%
subset(age_group %in% c("0-4 yrs", "5-17 yrs")) -> saved_age_groups
tmp %>%
mutate(
age_group = recode_factor(age_group,
"0-4 yrs" = "0 - 17",
"5-17 yrs" = "0 - 17",
"18-49 yrs" = "18 - 49",
"50-64 yrs" = "50 - 64",
"65+ yrs" = "65+"
)
) %>%
rbind(saved_age_groups) %>%
group_by(age_group, season, measure) %>%
summarise_at(c("ci_lower", "ci_upper", "value"), sum, na.rm = TRUE) %>%
ungroup() %>%
mutate(rate = grepl("*rate", measure)) %>%
rename(upper_ci = "ci_upper", lower_ci = "ci_lower") %>%
select(c(required_columns, measure, rate)) -> burden
usethis::use_data(burden,
overwrite = T
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.