-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcorona.Rmd
195 lines (146 loc) · 7.91 KB
/
corona.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
---
title: "**Global COVID-19 Data**"
output:
html_document:
includes:
in_header: google-analytics.html
runtime: shiny
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(IQRtools)
library(ggplot2)
library(shiny)
```
```{r update_data, echo=FALSE}
source("Resources/00_getPopulation.R")
source("Resources/01_importData.R")
source("Resources/02_analysis.R") # This script might not be needed ... single plotting functions could be in the RMD
```
---
## Source data
* <a href="https://github.com/CSSEGISandData/COVID-19/tree/master/csse_covid_19_data/csse_covid_19_time_series">Global Data (time_series_covid19_confirmed_global.csv and time_series_covid19_deaths_global.csv)</a>
* <a href="https://www.worldometers.info/world-population/population-by-country/">Population per country</a>
```{r load_data, echo=FALSE}
# Load the processed source data (all countries included)
data <- IQRloadCSVdata("Resources/data.csv")
# Get last day data
dataLast <- do.call(rbind,lapply(split(data,data$COUNTRY), function (d) d[nrow(d),]))
```
**Last update of source data: `r dataLast$DATE[1]`**
---
## Just some graphics
COVID-19 keeps us all busy. The plots below have been quickly put together to monitor the developments. Far more interesting things could be done with the data - but there are other commitments at the moment. Still - I find them useful.
```{r country_selection, echo=FALSE}
inputPanel(
selectInput("countries", "Selected Countries:",
c("China", "Italy", "Iran", "Spain", "Germany", "United States", "France", "South Korea", "Switzerland", "United Kingdom", "Netherlands", "Austria", "Belgium", "Norway", "Sweden", "Denmark", "Japan", "Malaysia", "Canada", "Portugal", "Australia", "Israel", "Brazil", "Ireland", "Qatar", "Pakistan", "Greece", "Finland", "Poland", "Singapore", "Luxembourg", "Iceland", "Indonesia", "Slovenia", "Bahrain", "Romania", "Saudi Arabia", "Thailand", "Estonia", "Egypt", "Chile", "Peru", "Philippines", "Ecuador", "Russia", "India", "Iraq", "Turkey", "Lebanon", "South Africa", "Kuwait", "United Arab Emirates", "Slovakia", "San Marino", "Mexico", "Armenia", "Panama", "Croatia", "Serbia", "Colombia", "Argentina", "Bulgaria", "Algeria", "Latvia", "Vietnam", "Uruguay", "Brunei", "Hungary", "Costa Rica", "Jordan", "Cyprus", "Albania", "Bosnia and Herzegovina", "Morocco", "Sri Lanka", "Andorra", "Malta", "Belarus", "Moldova", "North Macedonia", "Oman", "Azerbaijan", "Kazakhstan", "Venezuela", "Georgia", "Tunisia", "Cambodia", "Lithuania", "Dominican Republic", "Burkina Faso", "Senegal", "Liechtenstein", "New Zealand", "Martinique", "Uzbekistan", "Afghanistan", "Bangladesh", "Ukraine", "Jamaica", "Cameroon", "Maldives", "Bolivia", "Honduras", "Cuba", "Ghana", "Paraguay", "Guatemala", "Trinidad and Tobago", "Nigeria", "Rwanda", "Guyana", "Kenya", "Monaco", "Equatorial Guinea", "Ethiopia", "Mongolia", "Seychelles", "Tanzania", "Barbados", "Kyrgyzstan", "Mauritius", "Montenegro", "Namibia", "Benin", "Liberia", "Mauritania", "Saint Lucia", "Sudan", "Zambia", "Antigua and Barbuda", "Bhutan", "Central African Republic", "Chad", "Djibouti", "El Salvador", "Eswatini", "Fiji", "Gabon", "Guinea", "Holy See", "Nepal", "Nicaragua", "Somalia", "Suriname", "Togo"),
multiple = TRUE,size = 10,selectize = FALSE,selected = c("Sweden","Switzerland","Germany","France","Italy","United States","Spain")
)
)
```
### Cases per Million Inhabitants since > 5 Confirmed Cases per Million
This plot shows the number of cases for confirmed infections and deaths per 1 Million of inhabitants.
**"Day 0"** in this plot is the day at which a country the first time reported confirmed infections
greater than 5 per Million of inhabitants.
Both normalizations (in terms of time and population) are important to compare the infection dynamics
in the different countries.
```{r plot6, echo=FALSE}
# The plot functions are stored in the script ... 02_analysis.R
# THIS IS NOT NICE ... just happened because of old shiny thingy ... here it could be made nicer I guess.-
renderPlot({
genplots(input$countries)[[6]]
},height = 400)
```
### Daily cases - Confirmed
Daily confirmed cases for the last 31 days. Time 0 indicates "Today" or rather the last available time point.
The solid line is computerd using a simple loess smoother.
```{r plot1a, echo=FALSE}
renderPlot({
genplots(input$countries)[[7]]
},height = 600)
```
### Daily cases - Deaths
Daily deaths for the last 31 days. Time 0 indicates "Today" or rather the last available time point.
The solid line is computerd using a simple loess smoother.
```{r plot1b, echo=FALSE}
renderPlot({
genplots(input$countries)[[8]]
},height = 600)
```
### Daily cases - Recoveres
Daily deaths for the last 31 days. Time 0 indicates "Today" or rather the last available time point.
The solid line is computerd using a simple loess smoother.
```{r plot1b, echo=FALSE}
renderPlot({
genplots(input$countries)[[9]]
},height = 600)
```
### Absolute Number of Cases
Absolute number of cases for confirmed infections and deaths are plotted below.
**Note that consideration of these numbers suffers from the following shortcomings:**
* Currently almost no country has an adequate test coverage to really assess the number of infections
* Absolute infections per country should not be used to compare between countries. Relative numbers per
population of a country is more of interest. After all medical treatment facilities, such as ICU beds
typically have also relative numbers to the population.
* Comparison between countries as below also suffers from different times of onset of the epidemic.
* The most informative, and currently least biased measure is deaths.
```{r plot1, echo=FALSE}
renderPlot({
genplots(input$countries)[[1]]
},height = 400)
```
### Relative Number of Deaths
The following plot shows the relative number of deaths vs. confirmed cases.
There is a high variability in these numbers. Countries with a total overload of health care facilities (ICU beds)
are likely to see higher death rates due to COVID-19. So this is an "interesting" measure to consider over time as the "Wave" rolls
over Switzerland (for example).
**One of the most important factors though might be the rate of testing within a country!** The fewer tests are conducted
per population, the higher the death versus confirmed rate. Germany has conducted over 100000 test (status 19th March 2020)
and South Korea even several folds higher.
```{r plot2, echo=FALSE}
renderPlot({
genplots(input$countries)[[2]]
},height = 400)
```
### Number of Cases per Million Inhabitants
Relative number of cases (per Million inhabitants) for confirmed infections and deaths are plotted below.
Far more interesting plot than the absolute number of cases. Just compare your countries of interest and
make up your own mind.
```{r plot3, echo=FALSE}
renderPlot({
genplots(input$countries)[[3]]
},height = 400)
```
### Relative Number of Deaths (`r dataLast$DATE[1]`)
The following plot shows the relative number of deaths vs. confirmed cases.
Date considered here: `r dataLast$DATE[1]`
```{r plot4, echo=FALSE}
renderPlot({
genplots(input$countries)[[4]]
},height = 400)
```
### Number of Cases per Million Inhabitants (`r dataLast$DATE[1]`)
Relative number of cases (per Million inhabitants) for confirmed infections and death are plotted below.
Date considered here: `r dataLast$DATE[1]`
```{r plot5, echo=FALSE}
renderPlot({
genplots(input$countries)[[5]]
},height = 400)
```
### Number of relative newly confirmed cases (`r dataLast$DATE[1]`)
The number of daily new cases relative to total active cases (Confirmed-Dead-Recovered)
Date considered here: `r dataLast$DATE[1]`
```{r plot10, echo=FALSE}
renderPlot({
genplots(input$countries)[[10]]
},height = 400)
```
### Number of relative newly confirmed cases (`r dataLast$DATE[1]`)
Same on log-scale
Date considered here: `r dataLast$DATE[1]`
```{r plot11, echo=FALSE}
renderPlot({
genplots(input$countries)[[11]]
},height = 400)
```