knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(covidrecon) library(dplyr) library(ggplot2) library(tidyr) library(purrr)
covid <- covid_latest()
highlight_countries <- c("Japan", "South_Korea", "Singapore", "Italy", "Iran", "China", "France", "United_Kingdom", "Sweden", "Australia")
covid_subset <- covid %>% filter(country_region %in% c(highlight_countries, "United_States_of_America", "Germany", "Denmark")) covid_changepoint <- covid_subset %>% add_covid_change_point() %>% filter(date >= change_point_date)
covid_instant_r <- add_instant_reproduction(covid_changepoint)
gg_effective_repro_facet(covid_instant_r)
gg_effective_repro_all(covid_instant_r)
library(lubridate) gg + geom_line_interactive(size = 1.2) %>% girafe(ggobj = ., options = list( opts_tooltip(use_stroke = TRUE, opacity = 0.7), opts_hover(css = "stroke:black;"), opts_toolbar(position = "topright", saveaspng = TRUE) )) hubei_incidence_function_data <- covid %>% filter(date >= ymd("2020-01-11")) %>% mutate(HubeiSansWuhan = if_else( condition = is.na(HubeiSansWuhan), true = 0, false = HubeiSansWuhan)) %>% mutate(incident_cases = ifelse(Date < ymd("2020-02-15"), Wuhan + HubeiSansWuhan, Hubei)) %>% mutate(date = format(date, "%Y-%m-%d")) %>% select(Date, incident_cases) %>% uncount(incident_cases) hubei_incidence_object <- incidence(hubei_incidence_function_data$Date)
countries_errors <- country_repro_errors(covid_estimated_repro) covid_estimated_repro %>% filter(geo_id %in% countries_errors) %>% select(geo_id, repro_estimate) %>% unnest(cols = c(repro_estimate)) %>% slice(2) %>% pull(repro_estimate)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.