Commit 19a76e40 authored by numeroteca's avatar numeroteca

add Cataluña https://app.powerbi.com/view?r=eyJrIjoiZT... data overwrites deaths.

parent 99f58e2e
# cataluña
# Donwloaded from https://analisi.transparenciacatalunya.cat/Salut/Registre-de-test-de-COVID-19-realitzats-a-Cataluny/jj6z-iyrp/data
catalunya_original <- read.delim("data/original/spain/catalunya/Registre_de_test_de_COVID-19_realitzats_a_Catalunya._Segregaci__per_sexe_i_municipi.csv",sep = ",")
powerbi <- read.delim("data/original/spain/catalunya/powerbi.csv",sep = ",")
catalunya <- catalunya_original
# cases -------------
# creates date variable
catalunya$date <- as.Date(catalunya$TipusCasData, "%d/%m/%Y")
# extracts first charatcter of zipcode to select province code
......@@ -80,3 +82,20 @@ ggplot(cattotal) +
# ggplot(cattotal) +
# geom_line(aes(date,cases_accumulated, group = provincia_code)) +
# facet_grid(~province)
# Fallecimientos ------
powerbi$date <- as.Date(powerbi$fecha, "%d/%m/%y")
ggplot(powerbi) +
geom_line(data = filter (data_cases_sp_provinces, ccaa =="Cataluña" ) , aes(date, deceased, group = province, color ="#000000"),size = 1) +
geom_point(data = filter (data_cases_sp_provinces, ccaa =="Cataluña" ) , aes(date,deceased ),size = 1) +
geom_line(aes(date,deceased, group = province, color = "#DD0000")) +
geom_point(aes(date,deceased), color = "red", size = 0.5) +
scale_color_identity(
guide = "legend",
labels = c("esCovid19data", "powerbi"),
) +
scale_y_log10() +
facet_grid(~province)
......@@ -171,7 +171,20 @@ uniprovinciales <- ciii %>%
# Add new Andalucía data
data_cases_sp_provinces <- rbind(data_cases_sp_provinces,uniprovinciales)
# Add missin Barcelona data --------
# Overwrite Catalunya provinces death data ------------------
powerbi <- read.delim("data/original/spain/catalunya/powerbi.csv",sep = ",")
powerbi$date <- as.Date(powerbi$fecha, "%d/%m/%y")
data_cases_sp_provinces$dunique <- paste0(data_cases_sp_provinces$date,data_cases_sp_provinces$province)
powerbi$dunique <- paste0(powerbi$date,powerbi$province)
data_cases_sp_provinces <- merge(data_cases_sp_provinces, powerbi %>% select(-date) %>% select(-province) %>% rename(deceased_cat = deceased ) ,
by.x="dunique", by.y="dunique", all.x = TRUE)
data_cases_sp_provinces <- data_cases_sp_provinces %>% mutate(
deceased = ifelse( ccaa == "Cataluña", deceased_cat, deceased)
)
# Add missing Barcelona data --------
# # Do not use as data have been hasd coded in the original data
# # select all the cataluña provinces (Barcelona is not available) to calculate how many deaths
# prov_cat <- data_cases_sp_provinces %>% filter( ccaa == "Cataluña" & province != "Barcelona" & date > as.Date("2020-03-08") ) %>%
......
fecha,province,deceased
01/03/20,Lleida,0
02/03/20,Lleida,0
03/03/20,Lleida,0
04/03/20,Lleida,0
05/03/20,Lleida,0
06/03/20,Lleida,0
07/03/20,Lleida,0
08/03/20,Lleida,0
09/03/20,Lleida,0
10/03/20,Lleida,0
11/03/20,Lleida,0
12/03/20,Lleida,0
13/03/20,Lleida,0
14/03/20,Lleida,0
15/03/20,Lleida,0
16/03/20,Lleida,1
17/03/20,Lleida,2
18/03/20,Lleida,3
19/03/20,Lleida,3
20/03/20,Lleida,3
21/03/20,Lleida,3
22/03/20,Lleida,4
23/03/20,Lleida,9
24/03/20,Lleida,12
25/03/20,Lleida,17
26/03/20,Lleida,26
27/03/20,Lleida,35
28/03/20,Lleida,38
29/03/20,Lleida,45
30/03/20,Lleida,49
31/03/20,Lleida,56
01/04/20,Lleida,64
02/04/20,Lleida,72
03/04/20,Lleida,76
04/04/20,Lleida,78
05/04/20,Lleida,80
06/04/20,Lleida,89
07/04/20,Lleida,93
08/04/20,Lleida,96
09/04/20,Lleida,98
10/04/20,Lleida,102
11/04/20,Lleida,109
12/04/20,Lleida,115
13/04/20,Lleida,117
14/04/20,Lleida,121
15/04/20,Lleida,122
16/04/20,Lleida,124
17/04/20,Lleida,128
18/04/20,Lleida,133
19/04/20,Lleida,137
20/04/20,Lleida,145
21/04/20,Lleida,151
22/04/20,Lleida,156
23/04/20,Lleida,160
24/04/20,Lleida,164
25/04/20,Lleida,164
26/04/20,Lleida,165
01/03/20,Tarragona,0
02/03/20,Tarragona,0
03/03/20,Tarragona,0
04/03/20,Tarragona,0
05/03/20,Tarragona,0
06/03/20,Tarragona,0
07/03/20,Tarragona,0
08/03/20,Tarragona,0
09/03/20,Tarragona,0
10/03/20,Tarragona,0
11/03/20,Tarragona,0
12/03/20,Tarragona,0
13/03/20,Tarragona,0
14/03/20,Tarragona,0
15/03/20,Tarragona,0
16/03/20,Tarragona,1
17/03/20,Tarragona,1
18/03/20,Tarragona,1
19/03/20,Tarragona,2
20/03/20,Tarragona,3
21/03/20,Tarragona,3
22/03/20,Tarragona,5
23/03/20,Tarragona,7
24/03/20,Tarragona,9
25/03/20,Tarragona,14
26/03/20,Tarragona,19
27/03/20,Tarragona,26
28/03/20,Tarragona,29
29/03/20,Tarragona,38
30/03/20,Tarragona,48
31/03/20,Tarragona,60
01/04/20,Tarragona,63
02/04/20,Tarragona,72
03/04/20,Tarragona,79
04/04/20,Tarragona,85
05/04/20,Tarragona,88
06/04/20,Tarragona,99
07/04/20,Tarragona,110
08/04/20,Tarragona,122
09/04/20,Tarragona,139
10/04/20,Tarragona,148
11/04/20,Tarragona,154
12/04/20,Tarragona,158
13/04/20,Tarragona,168
14/04/20,Tarragona,187
15/04/20,Tarragona,193
16/04/20,Tarragona,210
17/04/20,Tarragona,212
18/04/20,Tarragona,216
19/04/20,Tarragona,222
20/04/20,Tarragona,226
21/04/20,Tarragona,235
22/04/20,Tarragona,242
23/04/20,Tarragona,247
24/04/20,Tarragona,250
25/04/20,Tarragona,254
26/04/20,Tarragona,255
27/04/20,Tarragona,257
01/03/20,Girona,0
02/03/20,Girona,0
03/03/20,Girona,0
04/03/20,Girona,0
05/03/20,Girona,0
06/03/20,Girona,0
07/03/20,Girona,0
08/03/20,Girona,0
09/03/20,Girona,0
10/03/20,Girona,0
11/03/20,Girona,0
12/03/20,Girona,0
13/03/20,Girona,0
14/03/20,Girona,0
15/03/20,Girona,0
16/03/20,Girona,0
17/03/20,Girona,2
18/03/20,Girona,3
19/03/20,Girona,3
20/03/20,Girona,8
21/03/20,Girona,14
22/03/20,Girona,21
23/03/20,Girona,28
24/03/20,Girona,34
25/03/20,Girona,45
26/03/20,Girona,54
27/03/20,Girona,66
28/03/20,Girona,77
29/03/20,Girona,94
30/03/20,Girona,103
31/03/20,Girona,111
01/04/20,Girona,127
02/04/20,Girona,138
03/04/20,Girona,151
04/04/20,Girona,169
05/04/20,Girona,179
06/04/20,Girona,190
07/04/20,Girona,207
08/04/20,Girona,219
09/04/20,Girona,229
10/04/20,Girona,236
11/04/20,Girona,244
12/04/20,Girona,258
13/04/20,Girona,265
14/04/20,Girona,273
15/04/20,Girona,280
16/04/20,Girona,289
17/04/20,Girona,310
18/04/20,Girona,324
19/04/20,Girona,327
20/04/20,Girona,338
21/04/20,Girona,344
22/04/20,Girona,356
23/04/20,Girona,363
24/04/20,Girona,371
25/04/20,Girona,383
26/04/20,Girona,393
27/04/20,Girona,397
01/03/20,Barcelona,0
02/03/20,Barcelona,1
03/03/20,Barcelona,1
04/03/20,Barcelona,2
05/03/20,Barcelona,2
06/03/20,Barcelona,2
07/03/20,Barcelona,2
08/03/20,Barcelona,2
09/03/20,Barcelona,3
10/03/20,Barcelona,4
11/03/20,Barcelona,7
12/03/20,Barcelona,11
13/03/20,Barcelona,20
14/03/20,Barcelona,35
15/03/20,Barcelona,41
16/03/20,Barcelona,58
17/03/20,Barcelona,75
18/03/20,Barcelona,114
19/03/20,Barcelona,164
20/03/20,Barcelona,229
21/03/20,Barcelona,304
22/03/20,Barcelona,391
23/03/20,Barcelona,497
24/03/20,Barcelona,614
25/03/20,Barcelona,759
26/03/20,Barcelona,906
27/03/20,Barcelona,1070
28/03/20,Barcelona,1234
29/03/20,Barcelona,1393
30/03/20,Barcelona,1585
31/03/20,Barcelona,1755
01/04/20,Barcelona,1922
02/04/20,Barcelona,2081
03/04/20,Barcelona,2229
04/04/20,Barcelona,2378
05/04/20,Barcelona,2510
06/04/20,Barcelona,2652
07/04/20,Barcelona,2777
08/04/20,Barcelona,2922
09/04/20,Barcelona,3052
10/04/20,Barcelona,3181
11/04/20,Barcelona,3314
12/04/20,Barcelona,3431
13/04/20,Barcelona,3533
14/04/20,Barcelona,3636
15/04/20,Barcelona,3744
16/04/20,Barcelona,3855
17/04/20,Barcelona,3965
18/04/20,Barcelona,4059
19/04/20,Barcelona,4157
20/04/20,Barcelona,4229
21/04/20,Barcelona,4320
22/04/20,Barcelona,4390
23/04/20,Barcelona,4457
24/04/20,Barcelona,4517
25/04/20,Barcelona,4571
26/04/20,Barcelona,4610
27/04/20,Barcelona,4619
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment