-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexplore.R
40 lines (36 loc) · 1.46 KB
/
explore.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
31
32
33
34
35
36
37
38
39
40
library(dplyr)
library(ggplot2)
source('plottingFunctions.R')
source('featureFunctions.R')
dat <- readRDS('./data/owid.rds')
dat$date <- as.Date(dat$date)
tmp <- (dat
%>% filter(population > 1000000)
%>% filter(location != 'Hong Kong')
%>% group_by(location)
%>% summarize(whichMax = which.max(new_cases_smoothed_per_million)
, maxDate = date[whichMax]
, maxCSpM = new_cases_smoothed_per_million[whichMax]
, pop = mean(population)
)
%>% filter(maxCSpM >= 10, !location %in% c('World', 'International'))
)
pdf('det_plots.pdf', onefile = T, width = 6, height = 5)
det_plot(dat %>% filter(location %in% tmp$location[1:20]), lineDec = F, lineInc = F)
det_plot(dat %>% filter(location %in% tmp$location[21:40]), lineDec = F, lineInc = F)
det_plot(dat %>% filter(location %in% tmp$location[41:60]), lineDec = F, lineInc = F)
det_plot(dat %>% filter(location %in% tmp$location[61:80]), lineDec = F, lineInc = F)
det_plot(dat %>% filter(location %in% tmp$location[81:100]), lineDec = F, lineInc = F)
det_plot(dat %>% filter(location %in% tmp$location[101:115]), lineDec = F, lineInc = F)
dev.off()
pdf('threeplots.pdf', onefile = T, width = 2, height = 6)
for(ll in tmp$location){
print(three_plot(ll))
}
dev.off()
pdf('uptick_plots.pdf', onefile = T, width = 4, height = 4)
for(ll in tmp$location){
dd <- dat %>% filter(location == ll)
print(uptick_plot(dd))
}
dev.off()