knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(covid19interventions) library(rvest) library(dplyr) # Install the package # Load the package library(lubridate) library(ggplot2) # run if you don't have covid19clark devtools::install_github("agroimpacts/covid19clark", build_vignettes = TRUE ) library(covid19clark)
# data load # covid interventions by county data("county_interventions") # covid cases data("us_cases_daily")
# interventions head(county_interventions) # covid cases by county str(us_cases_daily) # state stay at home order dates sah_states <- sah %>% filter(county == 'All') # counties in states with no stay at home orders sah_counties <- sah %>% filter(county != 'All') options(scipen=999) df1 <- data.frame(county_interventions) print (df1) df1$Intervention_Date<- coalesce(df1$SAH_County_Date, df1$SAH_State_Date) df1 print (df1)
library(ggplot2) library(tidyverse) df3 <- df1 %>% select(Intervention_Date, population) %>% filter (Intervention_Date <= as.Date("2020-04-10")) g <- ggplot(data = df3, aes(x=Intervention_Date, y=population)) + geom_bar( stat="identity", fill = 'steelblue') g
library(ggplot2) library(tidyverse) df3 <- df1 %>% select(interve, population) %>% filter (interve <= as.Date("2020-04-10")) g <- ggplot(data = df3, aes(x=population, y=interve)) + geom_point() + geom_smooth(method="lm", se= FALSE) g
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.