knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
knitr::opts_chunk$set(echo = TRUE)
library(ITFAnalytics)
library(tidyverse)

Epicurves (Global and Regional)

df <- onetable %>%
  dplyr::left_join(
    get_covid_df() %>%
      dplyr::select(-who_region), 
    by = c("iso2code" = "country_code")
    ) %>%
  calc_add_risk()
# Global
plot_epicurve(filter(df, !is.na(who_region) & source == "WHO"), transparent = F) %>%
  ggsave(filename = "C://Users/lanak/Desktop/epi_curve_transparent_who.png", width = 13, height = 7, units = "in", bg = "transparent")

plot_epicurve(filter(df, !is.na(who_region)  & source == "WHO"))%>%
  ggsave(filename = "C://Users/lanak/Desktop/epi_curve_who.png", width = 13, height = 7, units = "in")

#Regions
for (r in unique(filter(df, !is.na(who_region))$who_region)){
  plot_epicurve(filter(df, !is.na(who_region) & who_region == r), transparent = F) %>%
    ggsave(filename = paste0("C://Users/lanak/Desktop/epi_curve_", Sys.Date(), "_", r, ".png"), width = 9, height = 2.5, units = "in", bg = "transparent")
}
map_burden(
  df %>%
    mutate(result = cut(week_case_incidence, breaks = c(-0.1, 1, 10, 25, Inf))) %>%
    filter(date == Sys.Date()-8),
  country_coords
  )


randyyee/ITFAnalytics documentation built on Dec. 22, 2021, 12:56 p.m.