{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE)
```{r Getting Data}
library(scales) library(dplyr) library(ggplot2)
file <- “https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-counties.csv”
NYTimesData <- read.csv(file, header=TRUE)
NYTimesData %>% filter(date == “2020-05-01” & state == “Texas”) %>% group_by(state) %>% summarize(Total_Cases = sum(cases))
NYTimesData %>% filter(state == “Texas” | state == “New York” | state == “Louisiana”) %>% filter(county == “Travis” | county == “Bexar” | county == “Harris” | county == “Dallas” | county == “Orleanss”) %>% group_by(date,county) %>% summarize(Total_Cases = sum(cases)) %>% ggplot(aes(x=date, y=Total_Cases))+geom_point()+facet_wrap(~ county)
TexasCounties <- filter(NYTimesData, county == “Travis” | county == “Bexar” | county == “Harris” | county == “Dallas”)
TexasCounties <- filter(TexasCounties,state == “Texas” | state == “New York” | state == “Louisiana”)
ggplot(TexasCounties, aes(date,cases))+geom_point()+theme_bw()+ facet_wrap(~county)
BexarCounty <- subset(TexasCounties, TexasCounties$county == “Bexar”)
BexarCounty <- BexarCounty %>% arrange(date) %>% mutate(newCases = cases - lag(cases, default = first(cases)))
BexarCounty <- BexarCounty %>% mutate(CasesPerPop = cases / BexarCensus$TOT_POP)
ggplot(BexarCounty, aes(date,newCases))+geom_point()+theme_bw()
NewYorkCounty <- NYTimesData %>% filter(state == “New York” & county == “New York City”) %>% arrange(date) %>% mutate(newCases = cases - lag(cases, default = first(cases)))
ggplot(NewYorkCounty,aes(date,newCases))+geom_point()+theme_bw()+geom_smooth()
```