forked from CSSEGISandData/COVID-19
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcovid_19_western_europe.Rmd
469 lines (390 loc) · 25.9 KB
/
covid_19_western_europe.Rmd
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
---
title: "COVID-19 in Switzerland and Western Europe"
output:
html_document:
number_sections: yes
toc: yes
html_notebook:
fig_height: 5
fig_width: 7
number_sections: yes
toc: yes
word_document:
toc: yes
pdf_document: default
date: "Last updated: `r format(Sys.time(), '%d %B, %Y - %H:%M')`"
author: "Philippe Docourt"
---
```{r, echo=FALSE, warning=FALSE}
library(data.table)
get_timeseries_as_vector <- function(df) {
tmp <- subset(df, select = -c(1:4))
tmp <- sapply(as.vector(transpose(tmp)), as.integer)
return(tmp)
}
plot_time_series_for_country <- function(country.confirmed, country.deaths, country.recovered=NULL, country.population=NA, country.name="", public.spaces.closed.at=NA, confinement.at=NA, trend.angle=20) {
day.count <- nrow(country.confirmed)
ylim <- c(0, 1.4 * max(country.confirmed, na.rm = TRUE))
day.start <- min(c(45, public.spaces.closed.at, confinement.at), na.rm = TRUE)
plot(country.confirmed, main= paste("Cases in", country.name), type = "o", xlab = "Days Since January 21, 2020", ylab = "Cumulated Number of Confirmed Cases", col = "red", xlim = c(day.start, day.count + 25), ylim = ylim)
lines(seq(1, length(country.deaths)), country.deaths, type = "l", col = "black", lty = 1, lw = 1)
lines(seq(1, length(country.recovered)), country.recovered, type = "l", col = "green", lty = 1, lw = 1)
grid()
# Trend based on last two observations (last day).
last.confirmed <- tail(country.confirmed, n = 2)
dy <-last.confirmed[2] - last.confirmed[1]
slope <- dy
u <- c(1, dy)
a <- last.confirmed[1] - (day.count - 1) * slope
abline(a = a, b = slope, col = "violet", lw = 1.5, lty = 4)
last.progression.pct <- round((100 * dy) / last.confirmed[1])
text(x = day.count - (50 + trend.angle / 10), y = (0.82 - (trend.angle / 700)) * ylim[2], paste(dy, "cases/day\nExtrapolation:", dy * 7, "case/w.\n", last.progression.pct, "% progress last day"), srt = trend.angle, col = "violet")
# Trend based on last 8 observations (7 intervals, one week)
last.confirmed <- tail(country.confirmed, n = 8)
dy <-last.confirmed[8] - last.confirmed[1]
slope <- dy / 7
u <- c(7, dy)
a <- last.confirmed[1] - (day.count - 7) * slope
abline(a = a, b = slope, col = "black", lw = 1.5, lty = 4)
last.progression.pct <- round((100 * dy) / last.confirmed[1])
text(x = day.count - (15 + trend.angle / 20), y = (0.45 - (trend.angle/3000)) * ylim[2], paste(dy, "cases/w.\nAvg:", dy %/% 7, "case/day\n", last.progression.pct, "% progress last week"), srt = trend.angle, col = "black")
# Show special measures against propagation.
ypos = max(country.confirmed, na.rm = TRUE) %/% 3
if (!is.na(public.spaces.closed.at)) {
abline(v = public.spaces.closed.at, col = "blue", lw = 1, lty = 5)
text(x = public.spaces.closed.at - 5, y = ypos, "All public spaces are closed", col = "blue", srt = 90)
}
if (!is.na(confinement.at)) {
abline(v = confinement.at, col = "red", lw = 1, lty = 5)
text(x = confinement.at - 5, y = ypos, "Population is confined", col = "red", srt = 90)
}
legend("topleft", legend = c("Confirmed", "Deaths", "Recovered", "Confirmed trend based on last day", "Confirmed trend based on last week"), col = c("red", "black", "green", "violet", "black"), lty = c(rep(1, 3), 2, 3), lw = c(rep(1, 3), 1.5, 1.5))
if(!is.na(country.population)) {
proportion <- diff(country.confirmed/(country.population/100000))
plot(seq(2, day.count), proportion, type = "h", col = "cyan", xlim = c(day.start + 1, day.count), main = paste("New Confirmed Cases per Day per 100K Persons", country.name, sep = " in "), xlab = "Days Since January 21, 2020", ylab = "Number of New Cases per Day per 100K P.", lwd = 2)
grid()
incidence.last.week <- tail(country.confirmed, n=8)
incidence.last.week <- round((incidence.last.week[8] - incidence.last.week[1]) / (country.population/100000))
incidence.last.twoweeks <- tail(country.confirmed, n=15)
incidence.last.twoweeks <- round((incidence.last.twoweeks[15] - incidence.last.twoweeks[1]) / (country.population/100000))
incidence.last.threeweeks <- tail(country.confirmed, n=22)
incidence.last.threeweeks <- round((incidence.last.threeweeks[22] - incidence.last.threeweeks[1]) / (country.population/100000))
incidence.last.fourweeks <- tail(country.confirmed, n=29)
incidence.last.fourweeks <- round((incidence.last.fourweeks[29] - incidence.last.fourweeks[1]) / (country.population/100000))
evolution.of.incidence <- paste("Evolution of new confirmed cases per 100K persons over time:\n\nLast week:", incidence.last.week, "\nLast two weeks:", incidence.last.twoweeks, "\nLast three weeks:", incidence.last.threeweeks, "\nLast four weeks:", incidence.last.fourweeks)
text(x = day.start + 0.5 * (day.count - day.start), y = max(proportion) * 0.7, evolution.of.incidence)
}
diffs <- diff(country.confirmed)
plot(seq(2, day.count), diffs, type = "h", col = "cyan", xlim = c(day.start + 1, day.count), main = paste("New Confirmed Cases per Day", country.name, sep = " in "), xlab = "Days Since January 21, 2020", ylab = "Number of New Cases per Day", lwd = 2)
grid()
last.confirmed <- tail(country.confirmed, n = 9)
weekly.progress.ratio <- round((last.confirmed[9] + last.confirmed[8]) / (last.confirmed[2] + last.confirmed[1]), digits = 2)
last.confirmed <- tail(country.confirmed, n = 16)
twoweeks.progress.ratio <- round((last.confirmed[16] + last.confirmed[15]) / (last.confirmed[2] + last.confirmed[1]), digits = 2)
last.confirmed <- tail(country.confirmed, n = 23)
threeweeks.progress.ratio <- round((last.confirmed[23] + last.confirmed[22]) / (last.confirmed[2] + last.confirmed[1]), digits = 2)
last.confirmed <- tail(country.confirmed, n = 30)
monthly.progress.ratio <- round((last.confirmed[30] + last.confirmed[29]) / (last.confirmed[2] + last.confirmed[1]), digits = 2)
text(x = day.start + 0.5 * (day.count - day.start), y = max(diffs)*0.8, paste("Progression of new confirmed cases per day:\n\nLast week: x ", weekly.progress.ratio, " (", round(((twoweeks.progress.ratio/weekly.progress.ratio)-1)*100, 1), "% compared to prev. week)\nLast 2 weeks: x ", twoweeks.progress.ratio, " (", round(((threeweeks.progress.ratio/twoweeks.progress.ratio)-1)*100, 1), "% compared to prev. week)\nLast 3 weeks: x ", threeweeks.progress.ratio, " (", round(((monthly.progress.ratio/threeweeks.progress.ratio-1)*100), 1), "% compared to prev. week)\nLast 4 weeks: x ", monthly.progress.ratio, sep=""), col = "black")
if(!is.na(country.population)) {
proportion <- diff(country.deaths/(country.population/1000000))
plot(seq(2, day.count), proportion, type = "h", col = "black", xlim = c(day.start + 1, day.count), main = paste("New Deaths per Day per 1 Million Persons", country.name, sep = " in "), xlab = "Days Since January 21, 2020", ylab = "Number of New Deaths per Day per 1M P.", lwd = 2)
grid()
}
diffs <- diff(country.deaths)
plot(seq(2, day.count), diffs, type = "h", col = "black", xlim = c(day.start + 1, day.count), main = paste("New Deaths per Day", country.name, sep = " in "), xlab = "Days Since January 21, 2020", ylab = "Number of New Deaths per Day", lwd = 2)
grid()
if (!is.null(country.recovered)) {
diffs <- diff(country.recovered)
plot(seq(2, day.count), diffs, type = "h", col = "green", xlim = c(day.start + 1, day.count), main = paste("New Recovered Cases per Day in", country.name, sep = " in "), xlab = "Days Since January 21, 2020", ylab = "Number of New Recovered Cases per Day", lwd = 2)
grid()
diffs <- diff(country.confirmed - (country.deaths + country.recovered))
plot(seq(2, day.count), diffs, type = "h", col = "red", xlim = c(day.start + 1, day.count), main = paste("New Active Cases per Day", country.name, sep = " in "), xlab = "Days Since January 21, 2020", ylab = "Number of New Active Cases per Day", lwd = 2)
grid()
}
}
covid <- read.csv("csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv")
covid.deaths <- read.csv("csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_deaths_global.csv")
covid.recovered <- read.csv("csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_recovered_global.csv")
country.names <- c("Switzerland", "Italy", "France", "Germany", "Austria" , "Spain", "Great Britain", "Denmark", "Norway", "Sweden", "Finland", "Iceland", "Belgium")
country.count <- length(country.names)
col <- rainbow(country.count)
lty <- seq(1, country.count)
pch <- seq(10, 10 + country.count)
switzerland.confirmed <- get_timeseries_as_vector(subset(covid, Country.Region == "Switzerland"))
switzerland.deaths <- get_timeseries_as_vector(subset(covid.deaths, Country.Region == "Switzerland"))
switzerland.recovered <- get_timeseries_as_vector(subset(covid.recovered, Country.Region == "Switzerland"))
switzerland.population <- 8570000
italy.confirmed <- get_timeseries_as_vector(subset(covid, Country.Region == "Italy"))
italy.deaths <- get_timeseries_as_vector(subset(covid.deaths, Country.Region == "Italy"))
italy.recovered <- get_timeseries_as_vector(subset(covid.recovered, Country.Region == "Italy"))
italy.population <- 60360000
france.confirmed <- get_timeseries_as_vector(subset(covid, Country.Region == "France" & Province.State == ""))
france.deaths <- get_timeseries_as_vector(subset(covid.deaths, Country.Region == "France" & Province.State == ""))
france.recovered <- get_timeseries_as_vector(subset(covid.recovered, Country.Region == "France" & Province.State == ""))
france.population <- 66990000
germany.confirmed <- get_timeseries_as_vector(subset(covid, Country.Region == "Germany"))
germany.deaths <- get_timeseries_as_vector(subset(covid.deaths, Country.Region == "Germany"))
germany.recovered <- get_timeseries_as_vector(subset(covid.recovered, Country.Region == "Germany"))
germany.population <- 83020000
austria.confirmed <- get_timeseries_as_vector(subset(covid, Country.Region == "Austria"))
austria.deaths <- get_timeseries_as_vector(subset(covid.deaths, Country.Region == "Austria"))
austria.recovered <- get_timeseries_as_vector(subset(covid.recovered, Country.Region == "Austria"))
austria.population <- 8859000
spain.confirmed <- get_timeseries_as_vector(subset(covid, Country.Region == "Spain"))
spain.deaths <- get_timeseries_as_vector(subset(covid.deaths, Country.Region == "Spain"))
spain.recovered <- get_timeseries_as_vector(subset(covid.recovered, Country.Region == "Spain"))
spain.population <- 46940000
uk.confirmed <- get_timeseries_as_vector(subset(covid, Country.Region == "United Kingdom" & Province.State == ""))
uk.deaths <- get_timeseries_as_vector(subset(covid.deaths, Country.Region == "United Kingdom" & Province.State == ""))
uk.recovered <- get_timeseries_as_vector(subset(covid.recovered, Country.Region == "United Kingdom" & Province.State == ""))
uk.population <- 66650000
denmark.confirmed <- get_timeseries_as_vector(subset(covid, Country.Region == "Denmark" & Province.State == ""))
denmark.deaths <- get_timeseries_as_vector(subset(covid.deaths, Country.Region == "Denmark" & Province.State == ""))
denmark.recovered <- get_timeseries_as_vector(subset(covid.recovered, Country.Region == "Denmark" & Province.State == ""))
denmark.population <- 5806000
norway.confirmed <- get_timeseries_as_vector(subset(covid, Country.Region == "Iceland"))
norway.deaths <- get_timeseries_as_vector(subset(covid.deaths, Country.Region == "Iceland"))
norway.recovered <- get_timeseries_as_vector(subset(covid.recovered, Country.Region == "Iceland"))
norway.population <- 5433000
sweden.confirmed <- get_timeseries_as_vector(subset(covid, Country.Region == "Sweden"))
sweden.deaths <- get_timeseries_as_vector(subset(covid.deaths, Country.Region == "Sweden"))
sweden.recovered <- get_timeseries_as_vector(subset(covid.recovered, Country.Region == "Sweden"))
sweden.population <- 10230000
finland.confirmed <- get_timeseries_as_vector(subset(covid, Country.Region == "Finland"))
finland.deaths <- get_timeseries_as_vector(subset(covid.deaths, Country.Region == "Finland"))
finland.recovered <- get_timeseries_as_vector(subset(covid.recovered, Country.Region == "Finland"))
finland.population <- 5522850
iceland.confirmed <- get_timeseries_as_vector(subset(covid, Country.Region == "Iceland"))
iceland.deaths <- get_timeseries_as_vector(subset(covid.deaths, Country.Region == "Iceland"))
iceland.recovered <- get_timeseries_as_vector(subset(covid.recovered, Country.Region == "Iceland"))
iceland.population <- 364134
belgium.confirmed <- get_timeseries_as_vector(subset(covid, Country.Region == "Belgium"))
belgium.deaths <- get_timeseries_as_vector(subset(covid.deaths, Country.Region == "Belgium"))
belgium.recovered <- get_timeseries_as_vector(subset(covid.recovered, Country.Region == "Belgium"))
belgium.population <- 11492641
countries.confirmed <- list(switzerland.confirmed, italy.confirmed, france.confirmed, germany.confirmed, austria.confirmed, spain.confirmed, uk.confirmed, denmark.confirmed, norway.confirmed, sweden.confirmed, finland.confirmed, iceland.confirmed, belgium.confirmed)
countries.deaths <- list(switzerland.deaths, italy.deaths, france.deaths, germany.deaths, austria.deaths, spain.deaths, uk.deaths, denmark.deaths, norway.deaths, sweden.deaths, finland.deaths, iceland.deaths, belgium.deaths)
countries.recovered <- list(switzerland.recovered, italy.recovered, france.recovered, germany.recovered, austria.recovered, spain.recovered, uk.recovered, denmark.recovered, norway.recovered, sweden.recovered, finland.recovered, iceland.recovered, belgium.recovered)
countries.population <- list(switzerland.population, italy.population, france.population, germany.population, austria.population, spain.population, uk.population, denmark.population, norway.population, sweden.population, finland.population, iceland.population, belgium.population)
day.count <- NROW(switzerland.confirmed)
```
# Evolution in Switzerland and Western Europe
The figures do not represent the same thing in each country, depending on the extent of the screening tests carried out. Regardless of this problem, the weekly and daily trend curves allow you to get an idea of the foreseeable evolution for the next days (assuming that the screening strategy does not change over time). Respectively, it provides an indication of a possible inflection of the progression of the epidemic in the near future.
IMPORTANT NOTE: The graphics below show values provided by official sources between 0 and 48h before the last update of this document. As an example, for Switzerland, you'll see the values up to October 22 at 12AM, even though the graphics were update on October 24 at 1AM! This is due to the lag between the time slot for communicating official figures and the time slot used by Johns Hopkins CSSE for releasing in their Git repository the aggregated figures for all official sources.
## Switzerland
```{r, echo=FALSE, warning=FALSE}
plot_time_series_for_country(switzerland.confirmed, switzerland.deaths, switzerland.recovered, switzerland.population, "Switzerland", 70, NA, trend.angle = 40)
```
## Italy
```{r, echo=FALSE, warning=FALSE}
plot_time_series_for_country(italy.confirmed, italy.deaths, italy.recovered, italy.population, "Italy", NA, trend.angle = 60)
```
## France
```{r, echo=FALSE, warning=FALSE}
plot_time_series_for_country(france.confirmed, germany.deaths, france.recovered, france.population, "France", 53, 56, trend.angle = 60)
```
## Germany
```{r, echo=FALSE, warning=FALSE}
plot_time_series_for_country(germany.confirmed, switzerland.deaths, germany.recovered, germany.population, "Germany", 48, NA, trend.angle = 55)
```
## Austria
```{r, echo=FALSE, warning=FALSE}
plot_time_series_for_country(austria.confirmed, austria.deaths, austria.recovered, austria.population, "Austria", 52, NA, trend.angle = 30)
```
## Spain
```{r, echo=FALSE, warning=FALSE}
plot_time_series_for_country(spain.confirmed, spain.deaths, spain.recovered, spain.population, "Spain", NA, 53, trend.angle = 50)
```
## Great Britain
```{r, echo=FALSE, warning=FALSE}
plot_time_series_for_country(uk.confirmed, uk.deaths, uk.recovered, uk.population, "Great Britain", NA, NA, trend.angle = 60)
```
## Denmark
```{r, echo=FALSE, warning=FALSE}
plot_time_series_for_country(denmark.confirmed, denmark.deaths, denmark.recovered, denmark.population, "Denmark", NA, NA, trend.angle = 70)
```
## Norway
```{r, echo=FALSE, warning=FALSE}
plot_time_series_for_country(norway.confirmed, norway.deaths, norway.recovered, norway.population, "Norway", NA, NA, trend.angle = 20)
```
## Sweden
```{r, echo=FALSE, warning=FALSE}
plot_time_series_for_country(sweden.confirmed, sweden.deaths, sweden.recovered, sweden.population, "Sweden", NA, NA, trend.angle = 60)
```
## Finland
```{r, echo=FALSE, warning=FALSE}
plot_time_series_for_country(finland.confirmed, finland.deaths, finland.recovered, finland.population, "Finland", NA, NA, trend.angle = 40)
```
## Iceland
```{r, echo=FALSE, warning=FALSE}
plot_time_series_for_country(iceland.confirmed, iceland.deaths, iceland.recovered, iceland.population, "Iceland", NA, NA, trend.angle = 20)
```
## Belgium
```{r, echo=FALSE, warning=FALSE}
plot_time_series_for_country(belgium.confirmed, belgium.deaths, belgium.recovered, belgium.population, "Belgium", 55, NA, trend.angle = 20)
```
# What Happened in Hubei Province (China)
```{r, echo=FALSE, warning=FALSE}
hubei.confirmed <- get_timeseries_as_vector(subset(covid, Country.Region == "China" & Province.State == "Hubei"))
hubei.deaths <- get_timeseries_as_vector(subset(covid.deaths, Country.Region == "China" & Province.State == "Hubei"))
hubei.recovered <- get_timeseries_as_vector(subset(covid.recovered, Country.Region == "China" & Province.State == "Hubei"))
plot_time_series_for_country(hubei.confirmed, hubei.deaths, hubei.recovered, NA, "Hubei Province, China", NA, 2, trend.angle = 0)
```
# What Is Happening in USA
```{r, echo=FALSE, warning=FALSE}
get_sum_of_timeseries_as_vector_for_usa <- function(df, exlude) {
tmp <- colSums(subset(df, select = -exlude))
tmp <- sapply(as.vector(transpose(as.list(tmp))), as.integer)
return(tmp)
}
covid.us <- read.csv("csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_US.csv")
covid.us.deaths <- read.csv("csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_deaths_US.csv")
usa.confirmed <- subset(covid.us, iso3 == "USA")
usa.deaths <- subset(covid.us.deaths, iso3 == "USA")
usa.confirmed <- get_sum_of_timeseries_as_vector_for_usa(usa.confirmed, c(1:11))
usa.deaths <- get_sum_of_timeseries_as_vector_for_usa(usa.deaths, c(1:12))
usa.population <- 330052960
plot_time_series_for_country(usa.confirmed, usa.deaths, country.recovered = NULL, usa.population, "USA", NA, NA, trend.angle=50)
```
# Comparison of Number of Confirmed Cases in Western Europe
```{r, echo=FALSE, warning=FALSE}
xrange <- c(35, day.count)
max.y <- 0
for (i in seq(1, country.count)) {
max.y <- max(c(max.y, countries.confirmed[[i]]), na.rm = TRUE)
}
yrange <- c(0, max.y)
plot(xrange, yrange, main= "Confirmed Cases", type = "n", xlab = "Days Since 2020-01-21", ylab = "Number of Cases")
for (i in seq(1, country.count)) {
lines(seq(1, day.count), countries.confirmed[[i]], type = "b", col = col[i], lty = 2, pch = 20, lw = 0.5)
}
grid()
legend("topleft", legend = country.names, col = col, lty = 2, pch = 20, title = "Country")
max.y <- 0
for (i in seq(1, country.count)) {
max.y <- max(c(max.y, diff(tail(countries.confirmed[[i]]))), na.rm = TRUE)
}
xrange <- c(day.count-10, day.count+0.2)
yrange <- c(0, max.y * 1.8)
plot(xrange, yrange, main= "New Confirmed Cases per Day (last 10 days)", type = "n", xlab = "Days Since 2020-01-21", ylab = "Number of New Cases per Day")
grid()
legend("topleft", legend = country.names, col = col, lty = 1, lw = 4, title = "Country", ncol = 4, cex = 0.9)
for (i in seq(1, country.count)) {
lines(seq(2, day.count) - 0.45 + 0.069 * i, diff(countries.confirmed[[i]]), type = "h", col = col[i], lty = 1, lw = 3)
}
plot(xrange, yrange/200, main= "New Confirmed Cases per Day per 100K Persons (last 10 days)", type = "n", xlab = "Days Since 2020-01-21", ylab = "Number of New Cases per Day per 100K P.")
grid()
legend("topleft", legend = country.names, col = col, lty = 1, lw = 4, title = "Country", ncol = 4, cex = 0.9)
for (i in seq(1, country.count)) {
lines(seq(2, day.count) - 0.45 + 0.069 * i, diff(countries.confirmed[[i]])/(countries.population[[i]][1]/100000), type = "h", col = col[i], lty = 1, lw = 3)
}
```
# Comparison of Number of Deaths in Western Europe
```{r, echo=FALSE, warning=FALSE}
xrange <- c(40, day.count)
max.y <- 0
for (i in seq(1, country.count)) {
max.y <- max(c(max.y, countries.deaths[[i]]), na.rm = TRUE)
}
yrange <- c(0, max.y)
plot(xrange, yrange, main= "Deaths", type = "n", xlab = "Days Since January 21, 2020", ylab = "Number of Deaths")
grid()
legend("topleft", legend = country.names, col = col, lty = 2, pch = 20, title = "Country")
for (i in seq(1, country.count)) {
lines(seq(1, day.count), countries.deaths[[i]], type = "b", col = col[i], lty = 2, pch = 20, lw = 1)
}
max.y <- 0
for (i in seq(1, country.count)) {
max.y <- max(c(max.y, diff(tail(countries.deaths[[i]]))), na.rm = TRUE)
}
xrange <- c(day.count-10, day.count+0.2)
yrange <- c(0, max.y * 1.3)
plot(xrange, yrange, main= "New Deaths per Day (last 10 days)", type = "n", xlab = "Days Since 2020-01-21", ylab = "Number of New Deaths per Day")
grid()
legend("topleft", legend = country.names, col = col, lty = 1, lw = 4, title = "Country", ncol = 4, cex = 0.9)
for (i in seq(1, country.count)) {
lines(seq(2, day.count) - 0.45 + 0.069 * i, diff(countries.deaths[[i]]), type = "h", col = col[i], lty = 1, lw = 3)
}
plot(xrange, yrange/50, main= "New Deaths per Day per 1 Mio Persons (last 10 days)", type = "n", xlab = "Days Since 2020-01-21", ylab = "Number of New Deaths per Day per 1 Mio P.")
grid()
legend("topleft", legend = country.names, col = col, lty = 1, lw = 4, title = "Country", ncol = 4, cex = 0.9)
for (i in seq(1, country.count)) {
lines(seq(2, day.count) - 0.45 + 0.069 * i, diff(countries.deaths[[i]])/(countries.population[[i]][1]/1000000), type = "h", col = col[i], lty = 1, lw = 3)
}
```
# Comparison of Number of Recovered Cases in Western Europe
```{r, echo=FALSE, warning=FALSE}
xrange <- c(40, day.count)
max.y <- 0
for (i in seq(1, country.count)) {
max.y <- max(c(max.y, countries.recovered[[i]]), na.rm = TRUE)
}
xrange <- c(50, day.count)
yrange <- c(0, max.y)
plot(xrange, yrange, main= "Recovered Cases", type = "n", xlab = "Days Since January 21, 2020", ylab = "Number of Cases")
grid()
legend("topleft", legend = country.names, col = col, lty = 2, pch = 20, title = "Country")
for (i in seq(1, country.count)) {
d <- nrow(countries.recovered[[i]])
lines(seq(1, d), countries.recovered[[i]], type = "b", col = col[i], lty = 2, pch = 20, lw = 1)
}
max.y <- 0
for (i in seq(1, country.count)) {
max.y <- max(c(max.y, diff(tail(countries.recovered[[i]]))), na.rm = TRUE)
}
xrange <- c(day.count-10, day.count+0.2)
yrange <- c(0, max.y * 1.3)
plot(xrange, yrange, main= "New Recovered Cases per Day (last 10 days)", type = "n", xlab = "Days Since 2020-01-21", ylab = "Number of New Recovered Cases per Day")
grid()
legend("topleft", legend = country.names, col = col, lty = 1, lw = 4, title = "Country", ncol = 4, cex = 0.9)
for (i in seq(1, country.count)) {
lines(seq(2, day.count) - 0.45 + 0.069 * i, diff(countries.recovered[[i]]), type = "h", col = col[i], lty = 1, lw = 3)
}
```
# Comparison of Number of Active Cases in Western Europe
```{r, echo=FALSE, warning=FALSE}
xrange <- c(40, day.count)
max.y <- 0
for (i in seq(1, country.count)) {
y <- countries.confirmed[[i]] - (countries.recovered[[i]] + countries.deaths[[i]])
max.y <- max(c(max.y, y), na.rm = TRUE)
}
yrange <- c(0, max.y)
plot(xrange, yrange, main= "Active Cases", type = "n", xlab = "Days Since January 21, 2020", ylab = "Number of Cases")
grid()
legend("topleft", legend = country.names, col = col, lty = 2, pch = 20, title = "Country")
for (i in seq(1, country.count)) {
y <- countries.confirmed[[i]] - (countries.recovered[[i]] + countries.deaths[[i]])
lines(seq(1, d), y, type = "b", col = col[i], lty = 2, pch = 20, lw = 1)
}
min.y <- 0
max.y <- 0
for (i in seq(1, country.count)) {
y <- countries.confirmed[[i]] - (countries.recovered[[i]] + countries.deaths[[i]])
y <- tail(y, 10)
max.y <- max(c(max.y, diff(y)), na.rm = TRUE)
min.y <- min(c(min.y, diff(y)), na.rm = TRUE)
}
xrange <- c(day.count-10, day.count+0.2)
yrange <- c(min.y, max.y * 1.3)
plot(xrange, yrange, main= "New Active Cases per Day (last 10 days)", type = "n", xlab = "Days Since 2020-01-21", ylab = "Number of New Active Cases per Day")
grid()
legend("topleft", legend = country.names, col = col, lty = 1, lw = 4, title = "Country", ncol = 4, cex = 0.9)
for (i in seq(1, country.count)) {
y <- countries.confirmed[[i]] - (countries.recovered[[i]] + countries.deaths[[i]])
lines(seq(2, day.count) - 0.45 + 0.069 * i, diff(y), type = "h", col = col[i], lty = 1, lw = 3)
}
```
# About
All the graphs above are generated from the data provided by Johns Hopkins CSSE (provided to the public strictly for educational and academic research purposes).
The source code for generating the graphs is available under MIT License at https://github.com/philippe-docourt/COVID-19/blob/master/covid_19_western_europe.Rmd.
The data are provided as *2019 Novel Coronavirus COVID-19 (2019-nCoV) Data Repository by Johns Hopkins CSSE* (see https://github.com/CSSEGISandData/COVID-19).
See https://github.com/philippe-docourt/COVID-19/blob/master/README.md for more details.
## Data Sources (Crawling Sources)
* BNO News: https://bnonews.com/index.php/2020/02/the-latest-coronavirus-cases/
* Worldometer: https://www.worldometers.info/coronavirus/
## Terms of Use
* Data : Creative Commons Attribution 4.0 International (CC BY 4.0) by the Johns Hopkins University on behalf of its Center for Systems Science in Engineering. Copyright Johns Hopkins University 2020. See https://github.com/CSSEGISandData/COVID-19/blob/master/README.md.
* Source code for generating graphs: Copyright Philippe Docourt. Licensed under MIT License. See https://github.com/philippe-docourt/COVID-19/blob/master/covid_19_western_europe.Rmd.
* Graphics : Public Domain