knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(covid19) library(dplyr) library(lubridate) library(ggplot2) deaths <- read_deaths_jhu_csse()
Plots cumulative number of confirmed deaths for a few selected countries.
deaths %>% dplyr::filter(country_region %in% c("Brazil", "Czechia", "China", "France", "Korea, South", "Iran", "Italy", "Spain", "US")) %>% dplyr::group_by(country_region, date) %>% dplyr::summarize(country_total = sum(cumulative_total)) %>% ggplot(aes(x = date, y = country_total, group = country_region, color = country_region)) + geom_point(na.rm = TRUE) + geom_line(aes(y = country_total), na.rm = TRUE) + theme( panel.grid.minor = element_line(color="grey60", size=0.5), panel.grid.major = element_line(color="grey40", size=0.5), panel.background = element_rect(fill="snow2") ) + ggtitle("Deaths for selected countries") + labs(x = "Date", y = "Cumulative Total", color = "Country")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.