-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUntitled.Rmd
More file actions
141 lines (103 loc) · 5.52 KB
/
Untitled.Rmd
File metadata and controls
141 lines (103 loc) · 5.52 KB
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
---
title: "COVID19 figures new cases, testing, death"
subtitle: "Sweden, Italy, France, Switzerland, Germany update 2020-12-04 "
output:
html_document:
keep_md: true
---
```{r setup, message = FALSE, echo = FALSE, warning=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(utility)
library(plotly)
library(hrbrthemes)
date<-Sys.Date()
data <- read.csv("https://opendata.ecdc.europa.eu/covid19/casedistribution/csv", na.strings = "", fileEncoding = "UTF-8-BOM")
data2 <- read.csv("https://covid.ourworldindata.org/data/owid-covid-data.csv", na.strings = "", fileEncoding = "UTF-8-BOM")
Gruppen<-data[ data$countriesAndTerritories=="Switzerland" | data$countriesAndTerritories=="Sweden" | data$countriesAndTerritories=="France" | data$countriesAndTerritories=="Germany" | data$countriesAndTerritories=="Italy" ,]
Gruppen$dateRep <- as.Date.factor(Gruppen$dateRep, format= "%d/%m/%Y")
colnames(Gruppen)[1]<-"Date"
colnames(Gruppen)[7]<- "Countries"
colnames(Gruppen)[12]<-"Cumul_14_days_cases_per_100000"
dd<-Gruppen[(Gruppen$Date > "2020-06-01" & Gruppen$Date < "2020-09-12"),]
########<><><><><><><><>####
p <- ggplot(Gruppen,aes(x = Date,y = Cumul_14_days_cases_per_100000,color=Countries))+geom_line() + theme_ipsum() + guides( color = FALSE)
p1 <- ggplot(Gruppen,aes(x = Date,y = cases,color=Countries))+geom_line() + theme_ipsum() + guides( color = FALSE)
p2 <- ggplot(Gruppen,aes(x = Date,y = deaths,color=Countries))+geom_line() + theme_ipsum() + guides( color = FALSE)
p3 <- ggplot(Gruppen,aes(x = Date,y = (Cumul_14_days_cases_per_100000)/2,color=Countries))+geom_line() + theme_ipsum() + guides( color = FALSE)
p<- ggplotly(p, dynamicTicks = TRUE) %>%
rangeslider()
p1<- ggplotly(p1, dynamicTicks = TRUE) %>%
rangeslider()
p2<- ggplotly(p2, dynamicTicks = TRUE) %>%
rangeslider()
```
***
##### New confirmed cases of COVID-19 (7-day smoothed) per million
***
```{r, message = FALSE, echo = FALSE, warning=FALSE,out.width="100%"}
Gruppen2<-data2[ data2$location=="Switzerland" | data2$location=="France" |data2$location=="Sweden" | data2$location=="Germany" | data2$location=="Italy" ,]
Gruppen2$date <- as.Date.factor(Gruppen2$date, format= "%Y-%m-%d")
dd<-Gruppen2[(Gruppen2$date > "2020-06-01"),]
p3 <- ggplot(dd,aes(x = date,y=new_cases_smoothed_per_million,color=location)) + geom_line () + theme_ipsum()
ggplotly(p3, dynamicTicks = TRUE) %>%
rangeslider()
```
##### Total_cases_per_million of COVID-19
***
```{r , message = FALSE, echo = FALSE, warning=FALSE,out.width="100%"}
Gruppen2<-data2[ data2$location=="Switzerland" | data2$location=="France" |data2$location=="Sweden" | data2$location=="Germany" | data2$location=="Italy" ,]
Gruppen2$date <- as.Date.factor(Gruppen2$date, format= "%Y-%m-%d")
dd<-subset(Gruppen2,date > "2020-05-01")
p3 <- ggplot(dd,aes(x = date,y=total_cases_per_million,color=location)) + geom_line () + theme_ipsum()
ggplotly(p3, dynamicTicks = TRUE) %>%
rangeslider()
```
##### Death COVID-19 (new_deaths_per_million)
***
```{r, message = FALSE, echo = FALSE, warning=FALSE,out.width="100%"}
Gruppen2<-data2[ data2$location=="Switzerland" | data2$location=="France" |data2$location=="Sweden" | data2$location=="Germany" | data2$location=="Italy",]
Gruppen2$date <- as.Date.factor(Gruppen2$date, format= "%Y-%m-%d")
dd<-subset(Gruppen2,date > "2020-05-01")
p3 <- ggplot(dd,aes(x = date,y=new_deaths_per_million,color=location)) + geom_line () +
theme_ipsum()
ggplotly(p3, dynamicTicks = TRUE) %>%
rangeslider()
```
##### New deaths attributed to COVID-19 (7-day smoothed)
***
New tests for COVID-19 (7-day smoothed).
For countries that don't report testing data on a daily basis, we assume that testing changed equally on a daily basis over any periods in which no data was reported.
This produces a complete series of daily figures, which is then averaged over a rolling 7-day window
***
```{r, message = FALSE, echo = FALSE, warning=FALSE,out.width="100%"}
Gruppen2<-data2[ data2$location=="Switzerland" | data2$location=="France" |data2$location=="Sweden" | data2$location=="Germany" | data2$location=="Italy" ,]
Gruppen2$date <- as.Date.factor(Gruppen2$date, format= "%Y-%m-%d")
dd<-subset(Gruppen2,date > "2020-05-01")
p3 <- ggplot(dd,aes(x = date,y=new_deaths_per_million,color=location)) + theme_ipsum() +geom_smooth()
ggplotly(p3, dynamicTicks = TRUE) %>%
rangeslider()
```
##### new_tests_smoothed_per_thousand COVID-19 (7-day smoothed).
***
```{r, message = FALSE, echo = FALSE, warning=FALSE,out.width="100%"}
Gruppen2<-data2[ data2$location=="Switzerland" | data2$location=="France" |data2$location=="Sweden" | data2$location=="Germany" | data2$location=="Italy" ,]
Gruppen2$date<-as.Date(Gruppen2$date)
Gruppen2<-subset(Gruppen2,date > "2020-05-01")
p5 <- ggplot(Gruppen2,aes(x = date,y=new_tests_smoothed_per_thousand ,color=location)) + geom_line () + theme_ipsum()
ggplotly(p5, dynamicTicks = TRUE)
```
##### Tests conducted per new confirmed case of COVID-19
given as a rolling 7-day average (this is the inverse of positive_rate)
***
```{r, message = FALSE, echo = FALSE, warning=FALSE,out.width="100%"}
Gruppen2$date<-as.Date(Gruppen2$date)
dafortest<-subset(Gruppen2,date > "2020-05-01")
p5 <- ggplot(dafortest,aes(x = date,y=tests_per_case,color=location)) + geom_line () + theme_ipsum()
ggplotly(p5, dynamicTicks = TRUE)
```
Sources:
***
[opendata ecdc](https://opendata.ecdc.europa.eu/covid19/casedistribution/csv)
[ourworldindata](https://covid.ourworldindata.org/data/owid-covid-data.csv)
[Code book information](https://github.com/owid/covid-19-data/blob/master/public/data/owid-covid-codebook.csv)
***