-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmallMultiples.R
30 lines (25 loc) · 918 Bytes
/
smallMultiples.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
library(hrbrthemes)
#Remove unknown county
washington <- subset(washington,county != 'Unknown')
nytimes <- subset(nytimes,county != 'Unknown')
county_data = tibble()
for (c in unique(washington$county)) {
print(c)
county_info <-subset(washington,county == c & county != 'Unknown')
county_fips = unique(county_info$fips)
county_data <- bind_rows(county_data,tibble(state ='Washington',
county = c,
date = tail(county_info$date,-1),
new_cases = diff(county_info$cases),
new_deaths = diff(county_info$deaths) )
)
}
county_data$date <- as.Date(county_data$date)
county_data %>%
# filter(date >='2021-01-01') %>%
ggplot(aes(x=date,y=new_cases))+
geom_line(group=1) +
facet_wrap(~county,scales = "free") +
labs(x="", y="",
title="New Cases by county") +
theme_ipsum()