Advertisement
bdill

coronavirus_2020-03-16.R

Mar 16th, 2020
815
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 1.06 KB | None | 0 0
  1.  
  2. # dataset: https://www.ecdc.europa.eu/en/publications-data/download-todays-data-geographic-distribution-covid-19-cases-worldwide
  3. library(readxl)
  4. library(tidyverse)
  5.  
  6. path <- "C:/Users/brian.dill/Downloads/COVID-19-geographic-disbtribution-worldwide-2020-03-16.xls"
  7. covid19 <- read_excel(path)
  8.  
  9. plotdata <- covid19 %>%
  10.   filter(CountryExp %in% c("United States of America","Iran","Italy", "China")) %>%
  11.   filter(DateRep > '2020-02-14') %>%
  12.   select(DateRep, Country = CountryExp, NewConfCases, NewDeaths)
  13.  
  14. ggplot(plotdata, aes(x = DateRep, y = NewConfCases, group = Country, color = Country))+
  15.   geom_line() +
  16.   labs(title = "Coronavirus Cases",
  17.        x = "Date Reported",
  18.        y = "# of new confirmed cases",
  19.        subtitle = "European Centre for Disease Prevention and Control",
  20.        linetype = "Country",
  21.        caption = "Source: https://www.ecdc.europa.eu/en/publications-data/download-todays-data-geographic-distribution-covid-19-cases-worldwide")
  22.  
  23. ggsave(filename = "C:/Users/brian.dill/Downloads/covid19.png", width = 10, height = 6, dpi = 120)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement