💾 Archived View for gemlog.blue › users › cariboudatascience › 1614630253.gmi captured on 2024-02-05 at 12:06:47. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-12-04)
-=-=-=-=-=-=-
library(ggplot2) library(scales) library(forecast) library(dplyr) library(forecast) library(readr) theme_set(theme_gray())
rm(list=ls()) US <- read_csv("./DATA/owid-covid-data.csv") %>% filter(location=="United States") %>% select(date,new_cases,new_deaths,total_cases,total_deaths)
US$MAC <- ma(US$new_cases,14,centre = TRUE) US$MAD <- ma(US$new_deaths,14,centre = TRUE) summary(US)
US %>% filter(date >="2020-01-24") %>% ggplot() + geom_line(aes(x=date,y=new_cases,col="Daily Cases"),lwd=1) + geom_line(aes(x=date,y=MAC,col="Moving Average"),lwd=1) + labs(title="US Daily Cases w/ 14 Day Moving Average",x="Year",y="Daily Cases") + scale_y_continuous(labels=comma)
US %>% filter(date >="2020-02-29") %>% ggplot() + geom_line(aes(x=date,y=new_deaths,col="Daily Deaths"),lwd=1) + geom_line(aes(x=date,y=MAD,col="Moving Average"),lwd=1) + labs(title="US Daily Deaths w/ 14 Day Moving Average",x="Year",y="Daily Deaths") + scale_y_continuous(labels=comma)