knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(covidrecon) library(dplyr) library(ggplot2)
covid <- covid_latest() covid_highest <- covid_high_incidence(covid) covid_changepoint <- add_covid_change_point(covid_highest)
highlight_countries <- c("Japan", "South_Korea", "Singapore", "Italy", "Iran", "China", "France", "United_Kingdom", "Sweden", "Australia")
covid_highlighted <- covid_changepoint %>% filter(country_region %in% c(highlight_countries, "United_States_of_America", "Germany", "Denmark"))
gg_covid_cases(covid_highlighted) + facet_grid(country_region ~ ., scales = "free_y") + geom_vline(aes(xintercept = change_point_date), colour = "salmon")
gg_covid_cumulative_cases(covid_highlighted) + facet_grid(country_region ~ ., scales = "free_y") + geom_vline(aes(xintercept = change_point_date), colour = "salmon")
covid_highlighted %>% group_by(country_region) %>% filter(date >= change_point_date) %>% mutate(days_since_change_point = diff_days(date, change_point_date)) %>% ggplot(aes(x = days_since_change_point, y = cumulative_cases, colour = country_region)) + geom_line() + scale_y_log10()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.