Commit 24a14bc1 authored by numeroteca's avatar numeroteca

fiz calculation of daily deaths in Euskadi

parent f3c263ef
......@@ -88,7 +88,7 @@ for( i in 1:nrow(files)) {
print("..........----the file:")
print(file)
print("////////////////////////////////////// preprocess")
if ( i < 131 ) { # menos que 16-Jul-2020.7f71933b706d67fd526700c2d23e4900728251ae.situacion-epidemiologica.xlsx
if ( i < 134 ) { # menos que 16-Jul-2020.7f71933b706d67fd526700c2d23e4900728251ae.situacion-epidemiologica.xlsx
actualizacion <- as.character( read_excel( paste0("data/original/spain/euskadi/situacion-epidemiologica/", file),
skip = 0, col_names = FALSE, sheet = "06", range ="B01" ) )
print("------actualizacion-----------")
......@@ -110,7 +110,7 @@ for( i in 1:nrow(files)) {
print("------------------names-----------------------")
print(names(original))
print("////////////////////////////////////// 2 process //////")
if ( i < 131) { # menos que 16-Jul-2020.7f71933b706d67fd526700c2d23e4900728251ae.situacion-epidemiologica.xlsx
if ( i < 134) { # menos que 16-Jul-2020.7f71933b706d67fd526700c2d23e4900728251ae.situacion-epidemiologica.xlsx
munip <- original %>% rename(
code = "Udalerria kodea / Código municipio",
municipio = "Udalerria / Municipio" ,
......@@ -127,7 +127,7 @@ for( i in 1:nrow(files)) {
fatalidad = fatalidad %>% str_replace(",",".") %>% as.numeric(ia),
date = as.Date(actualizacion[1]),
) # select(-code ) # %>% selec(-"...8", -"...9", - "...10" , -"...11" ,-"...12" )
} else if ( i > 132 & i < 164 ) { # cambia el formato y hace falta crear las columnas que no existen
} else if ( i > 135 & i < 167 ) { # cambia el formato y hace falta crear las columnas que no existen
# menos que 11-Jun-2020.bcdb0d9e98f64e67b7632e77d4c63cf94c59aeb7.situacion-epidemiologica.xlsx
munip <- original %>% rename(
# code = "Udalerria kodea / Código municipio",
......@@ -151,7 +151,7 @@ for( i in 1:nrow(files)) {
...12 = NA,
code = NA
) %>% select(names(munipdata ))
} else if ( i > 162) { # cambia el formato y hace falta crar las columnas que no existen: fallecidos y fatalidad
} else if ( i > 166) { # cambia el formato y hace falta crar las columnas que no existen: fallecidos y fatalidad
# más que 12-Jun-2020.7b7e48a0de46deb1dd1d78b214fde475075eff08.situacion-epidemiologica.xlsx
munip <- original %>% mutate(
"Hildakoak/Fallecidos" = NA,
......@@ -193,8 +193,29 @@ for( i in 1:nrow(files)) {
}
# munipdata2 <- munipdata
# munipdata <- munipdata2
# only
munipdata <- distinct( munipdata ) # elimina filas duplicadas
# manual fix para arreglar los problemas en la fuente de los datos
# eliminar el segundo 2021-01-17
# convertir el 2021-01-27 erroneo en 2021-01-24
# eliminar el 2021-01-24
munipdata <- munipdata %>% filter(
! date == as.Date("2021-01-24")
) %>% mutate(
date2 = as.character(date),
# date = ifelse( date == as.Date("2021-01-27"), as.Date("2021-01-24"), date)
date2 = ifelse( date == "2021-01-27", "2021-01-24", date2),
datemix = "placeholder"
) %>% group_by(municipio) %>% mutate(
datemix = ifelse( date == lead(date), "quitar", datemix),
date = as.Date(date2)
) %>% filter (
! datemix == "quitar"
)
# lista muicipios con código, porque antes de 2020-07-20 no tenian
municode <- munipdata %>% filter(date == as.Date("2020-11-08")) %>% select(code,municipio)
munipdata <- merge(
......@@ -527,8 +548,8 @@ munipdeath %>% filter( municipio %in% municipios_top$municipio) %>%
axis.text.x = element_text(size = 9, angle = 90),
legend.position = "none"
) +
labs(title = paste0("Fallecidos por semana* de COVID-19 por municipio en Euskadi" ),
subtitle = paste0("Capitales de provincia (*entre el 17 y 27 de enero pasaron 10 días). ", period_eus),
labs(title = paste0("Fallecidos por semana de COVID-19 por municipio en Euskadi" ),
subtitle = paste0("Capitales de provincia. ", period_eus),
y = "fallecidos por semana",
x = "2020-2021",
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -375,28 +375,28 @@
2021-01-08,10219,5522,86036,11636,12006,9289,88463,2057,65703,2120455,1276352,573969,203777,124753,123246,75517,25808,17821.9,15544,10788.1,272,0.4,236.3,220.3,1542
2021-01-09,11402,2227,86049,12416,12266,9140,91067,2038,65922,2139852,1282367,424201,216472,134453,126641,77288,19397,19207.6,6015,11041.1,219,0.3,245,234.7,1643
2021-01-10,5238,1837,86076,21961,12680,9149,88824,1748,66096,2150387,1287092,456983,222233,136999,128650,77915,10535,19571.3,4725,11130.7,174,0.3,221.7,246.6,1726
2021-01-11,7794,8197,86381,22361,13697,9319,91600,2287,66491,2179996,1305008,613512,237791,146176,135732,80943,29609,20882.3,17916,11563.3,395,0.6,262.7,253.9,1777
2021-01-12,11990,5424,86610,23566,14241,9506,92069,2356,66814,2207386,1319869,617527,247025,149431,140279,80115,27390,21347.3,14861,11445,323,0.5,297.3,260,1820
2021-01-13,12525,6012,86835,25087,14738,9572,92610,2435,67089,2239862,1336737,622629,261757,169152,145688,89825,32476,24164.6,16868,12832.1,275,0.4,331,271.7,1902
2021-01-14,13881,6647,87140,26507,15415,9600,93143,2542,67368,2274542,1354128,627656,284552,179895,156718,93320,34680,25699.3,17391,13331.4,279,0.4,292.3,276.7,1937
2021-01-15,15696,6331,87337,17291,15864,9658,93666,2632,67670,2312148,1372513,598176,316446,191693,171678,96161,37606,27384.7,18385,13737.3,302,0.4,285.3,281,1967
2021-01-16,15146,2634,87366,18333,16881,9700,91621,2592,67907,2339426,1380844,434148,334027,199574,175765,98477,27278,28510.6,8331,14068.1,237,0.4,272.7,283.6,1985
2021-01-17,7804,1907,87402,28766,18144,9683,92050,2707,68143,2357971,1386917,470802,344583,207584,177740,99825,18545,29654.9,6073,14260.7,236,0.3,258.3,292.4,2047
2021-01-18,8873,10466,87722,29037,19446,9853,95194,2963,68570,2391718,1408894,645865,357898,211722,184829,103886,33747,30246,21977,14840.9,427,0.6,300,297,2079
2021-01-19,15983,5581,88033,19903,20433,9964,95867,3067,69008,2427321,1427470,617953,369366,219935,187716,107601,35603,31419.3,18576,15371.6,438,0.6,367,313.4,2194
2021-01-20,18365,6271,88435,30537,21086,10083,96588,3215,69457,2467969,1445780,660170,397259,228107,198868,109043,40648,32586.7,18310,15577.6,449,0.7,438,338.3,2368
2021-01-21,16692,6471,88777,21592,22004,10090,97266,3321,69990,2507122,1463772,631090,412475,232580,202964,109644,39153,33225.7,17992,15663.4,533,0.8,473.3,374.6,2622
2021-01-22,16773,6821,89108,22750,22442,10170,97948,3479,70452,2548795,1483007,639867,428340,236647,206655,110494,41673,33806.7,19235,15784.9,462,0.7,481.3,397.4,2782
2021-01-23,13420,2518,89153,23518,23326,10010,95698,3410,70823,2575871,1491207,647248,436019,236445,208840,110363,27076,33777.9,8200,15766.1,371,0.5,455.3,416.6,2916
2021-01-24,10221,1833,89223,23989,24358,10106,96218,3501,71152,2597712,1497067,453767,447325,239741,209975,110150,21841,34248.7,5860,15735.7,329,0.5,387.3,429.9,3009
2021-01-25,14024,9656,89794,23517,25367,10239,99465,3819,71685,2635630,1517267,659092,455634,243912,212259,108373,37918,34844.6,20200,15481.9,533,0.7,411,445,3115
2021-01-26,17011,5312,90380,34227,25451,10307,100123,3911,72207,2672632,1533680,672093,465246,245311,213811,106210,37002,35044.4,16413,15172.9,522,0.7,461.3,457,3199
2021-01-27,16789,5922,90818,33966,25418,10388,100773,4003,72757,2709545,1549955,724633,469683,241576,213218,104175,36913,34510.9,16275,14882.1,550,0.8,535,471.4,3300
2021-01-28,14133,5857,91302,33630,25414,10392,101365,4087,73262,2741809,1566087,734129,467267,234687,211959,102315,32264,33526.7,16132,14616.4,505,0.7,525.7,467.4,3272
2021-01-29,14131,5210,91769,25567,24983,10459,101968,4192,73797,2776629,1580968,704670,464481,227834,208455,97961,34820,32547.7,14881,13994.4,535,0.7,530,477.9,3345
2021-01-30,13329,1852,91848,25944,25222,10372,99553,3997,74254,2802491,1587250,715074,463065,226620,206406,96043,25862,32374.3,6282,13720.4,457,0.6,499,490.1,3431
2021-01-31,7397,1490,91876,33501,26088,10307,99880,4055,74630,2821139,1591206,521662,463168,223427,204289,94139,18648,31918.1,3956,13448.4,376,0.5,456,496.9,3478
2021-02-01,10539,6883,92425,33004,26290,10513,103274,4311,75164,2849906,1605843,778532,458188,214276,196949,88576,28767,30610.9,14637,12653.7,534,0.7,455.7,497,3479
2021-02-02,13119,3285,93043,32832,25603,10666,103916,4278,75674,2876396,1616437,791618,449075,203764,188967,82757,26490,29109.1,10594,11822.4,510,0.7,473.3,495.3,3467
2021-02-03,9081,2632,0,24887,24898,10584,104440,3287,72695,2898371,1621950,760244,430402,188826,176170,71995,21975,26975.1,5513,10285,-2979,-3.9,-645,-8.9,-62
2021-02-04,6394,227,0,2456,10896,1,31,1192,22513,1047554,225188,568464,-1459568,-1694255,-1238584,-1340899,-1850817,-242036.4,-1396762,-191557,-50182,-69,-17550.3,-7249.9,-50749
2021-01-11,7794,8197,86381,22361,13697,9319,91600,2287,66460,2179996,1305008,613512,237791,146176,135732,80943,29609,20882.3,17916,11563.3,364,0.6,252.3,249.4,1746
2021-01-12,11990,5424,86610,23566,14241,9506,92069,2356,66783,2207386,1319869,617527,247025,149431,140279,80115,27390,21347.3,14861,11445,323,0.5,287,255.6,1789
2021-01-13,12525,6012,86835,25087,14738,9572,92610,2435,67058,2239862,1336737,622629,261757,169152,145688,89825,32476,24164.6,16868,12832.1,275,0.4,320.7,267.3,1871
2021-01-14,13881,6647,87140,26507,15415,9600,93143,2542,67337,2274542,1354128,627656,284552,179895,156718,93320,34680,25699.3,17391,13331.4,279,0.4,292.3,272.3,1906
2021-01-15,15696,6331,87337,17291,15864,9658,93666,2632,67639,2312148,1372513,598176,316446,191693,171678,96161,37606,27384.7,18385,13737.3,302,0.4,285.3,276.6,1936
2021-01-16,15146,2634,87366,18333,16881,9700,91621,2592,67876,2339426,1380844,434148,334027,199574,175765,98477,27278,28510.6,8331,14068.1,237,0.4,272.7,279.1,1954
2021-01-17,7804,1907,87402,28766,18144,9683,92050,2707,68112,2357971,1386917,470802,344583,207584,177740,99825,18545,29654.9,6073,14260.7,236,0.3,258.3,288,2016
2021-01-18,8873,10466,87722,29037,19446,9853,95194,2963,68654,2391718,1408894,645865,357898,211722,184829,103886,33747,30246,21977,14840.9,542,0.8,338.3,313.4,2194
2021-01-19,15983,5581,88033,19903,20433,9964,95867,3067,69092,2427321,1427470,617953,369366,219935,187716,107601,35603,31419.3,18576,15371.6,438,0.6,405.3,329.9,2309
2021-01-20,18365,6271,88435,30537,21086,10083,96588,3215,69541,2467969,1445780,660170,397259,228107,198868,109043,40648,32586.7,18310,15577.6,449,0.6,476.3,354.7,2483
2021-01-21,16692,6471,88777,21592,22004,10090,97266,3321,69990,2507122,1463772,631090,412475,232580,202964,109644,39153,33225.7,17992,15663.4,449,0.6,445.3,379,2653
2021-01-22,16773,6821,89108,22750,22442,10170,97948,3479,70452,2548795,1483007,639867,428340,236647,206655,110494,41673,33806.7,19235,15784.9,462,0.7,453.3,401.9,2813
2021-01-23,13420,2518,89153,23518,23326,10010,95698,3410,70823,2575871,1491207,647248,436019,236445,208840,110363,27076,33777.9,8200,15766.1,371,0.5,427.3,421,2947
2021-01-24,10221,1833,89223,23989,24358,10106,96218,3501,71152,2597712,1497067,453767,447325,239741,209975,110150,21841,34248.7,5860,15735.7,329,0.5,387.3,434.3,3040
2021-01-25,14024,9656,89794,23517,25367,10239,99465,3819,71795,2635630,1517267,659092,455634,243912,212259,108373,37918,34844.6,20200,15481.9,643,0.9,447.7,448.7,3141
2021-01-26,17011,5312,90380,34227,25451,10307,100123,3911,72317,2672632,1533680,672093,465246,245311,213811,106210,37002,35044.4,16413,15172.9,522,0.7,498,460.7,3225
2021-01-27,16789,5922,90818,33966,25418,10388,100773,4003,72867,2709545,1549955,724633,469683,241576,213218,104175,36913,34510.9,16275,14882.1,550,0.8,571.7,475.1,3326
2021-01-28,14133,5857,91302,33630,25414,10392,101365,4087,73372,2741809,1566087,734129,467267,234687,211959,102315,32264,33526.7,16132,14616.4,505,0.7,525.7,483.1,3382
2021-01-29,14131,5210,91769,25567,24983,10459,101968,4192,73907,2776629,1580968,704670,464481,227834,208455,97961,34820,32547.7,14881,13994.4,535,0.7,530,493.6,3455
2021-01-30,13329,1852,91848,25944,25222,10372,99553,3997,74364,2802491,1587250,715074,463065,226620,206406,96043,25862,32374.3,6282,13720.4,457,0.6,499,505.9,3541
2021-01-31,7397,1490,91876,33501,26088,10307,99880,4055,74740,2821139,1591206,521662,463168,223427,204289,94139,18648,31918.1,3956,13448.4,376,0.5,456,512.6,3588
2021-02-01,10539,6883,92425,33004,26290,10513,103274,4311,75274,2849906,1605843,778532,458188,214276,196949,88576,28767,30610.9,14637,12653.7,534,0.7,455.7,497,3479
2021-02-02,13119,3285,93043,32832,25603,10666,103916,4278,75784,2876396,1616437,791618,449075,203764,188967,82757,26490,29109.1,10594,11822.4,510,0.7,473.3,495.3,3467
2021-02-03,9081,2632,0,24887,24898,10584,104440,3287,76180,2898371,1621950,760244,430402,188826,176170,71995,21975,26975.1,5513,10285,396,0.5,480,473.3,3313
2021-02-04,6394,227,0,2456,10896,1,31,1192,22513,1047554,225188,568464,-1459568,-1694255,-1238584,-1340899,-1850817,-242036.4,-1396762,-191557,-53667,-70.4,-17587,-7265.6,-50859
"province","date","positivos","deceased","date_incremento","cases_incremento","daily_cases_avg7","deaths_incremento","daily_deaths_avg7"
"Bizkaia",2020-05-25,11026,NA,NA,NA,NA,NA,NA
"Bizkaia",2020-06-01,11286,NA,7,260,37.1,NA,NA
"Bizkaia",2020-06-01,11286,NA,NA,NA,NA,NA,NA
"Bizkaia",2020-06-08,11403,NA,7,117,16.7,NA,NA
"Bizkaia",2020-06-15,11642,918,7,239,34.1,NA,NA
"Bizkaia",2020-06-22,11799,926,7,157,22.4,8,1.1
......@@ -9,11 +8,11 @@
"Bizkaia",2020-07-13,12315,939,7,207,29.6,2,0.3
"Bizkaia",2020-07-20,12646,941,7,331,47.3,2,0.3
"Bizkaia",2020-07-27,13209,942,7,563,80.4,1,0.1
"Bizkaia",2020-08-03,14021,944,7,812,116,2,0.3
"Bizkaia",2020-08-10,15575,949,7,1554,222,5,0.7
"Bizkaia",2020-08-03,14018,944,7,809,115.6,2,0.3
"Bizkaia",2020-08-10,15575,949,7,1557,222.4,5,0.7
"Bizkaia",2020-08-17,17618,958,7,2043,291.9,9,1.3
"Bizkaia",2020-08-24,19929,974,7,2311,330.1,16,2.3
"Bizkaia",2020-08-31,22418,997,7,2489,355.6,23,3.3
"Bizkaia",2020-08-24,19927,974,7,2309,329.9,16,2.3
"Bizkaia",2020-08-31,22418,997,7,2491,355.9,23,3.3
"Bizkaia",2020-09-07,24605,1032,7,2187,312.4,35,5
"Bizkaia",2020-09-14,26513,1066,7,1908,272.6,34,4.9
"Bizkaia",2020-09-21,28034,1113,7,1521,217.3,47,6.7
......@@ -33,10 +32,10 @@
"Bizkaia",2020-12-27,58163,1630,7,1094,156.3,47,6.7
"Bizkaia",2021-01-03,59416,1657,7,1253,179,27,3.9
"Bizkaia",2021-01-10,61350,1697,7,1934,276.3,40,5.7
"Bizkaia",2021-01-17,65053,1759,7,3703,529,62,8.9
"Bizkaia",2021-01-27,68134,1823,10,3081,308.1,64,6.4
"Gipuzkoa",2020-05-25,3202,NA,NA,NA,NA,NA,NA
"Gipuzkoa",2020-06-01,3221,NA,7,19,2.7,NA,NA
"Bizkaia",2021-01-17,64148,1748,7,2798,399.7,51,7.3
"Bizkaia",2021-01-24,68134,1823,7,3986,569.4,75,10.7
"Bizkaia",2021-01-31,72405,1891,7,4271,610.1,68,9.7
"Gipuzkoa",2020-06-01,3221,NA,NA,NA,NA,NA,NA
"Gipuzkoa",2020-06-08,3249,NA,7,28,4,NA,NA
"Gipuzkoa",2020-06-15,3297,307,7,48,6.9,NA,NA
"Gipuzkoa",2020-06-22,3340,307,7,43,6.1,0,0
......@@ -45,11 +44,11 @@
"Gipuzkoa",2020-07-13,3594,308,7,142,20.3,0,0
"Gipuzkoa",2020-07-20,3954,308,7,360,51.4,0,0
"Gipuzkoa",2020-07-27,4215,309,7,261,37.3,1,0.1
"Gipuzkoa",2020-08-03,4484,309,7,269,38.4,0,0
"Gipuzkoa",2020-08-10,4848,310,7,364,52,1,0.1
"Gipuzkoa",2020-08-03,4483,309,7,268,38.3,0,0
"Gipuzkoa",2020-08-10,4848,310,7,365,52.1,1,0.1
"Gipuzkoa",2020-08-17,5360,311,7,512,73.1,1,0.1
"Gipuzkoa",2020-08-24,6121,315,7,761,108.7,4,0.6
"Gipuzkoa",2020-08-31,7490,322,7,1369,195.6,7,1
"Gipuzkoa",2020-08-24,6119,315,7,759,108.4,4,0.6
"Gipuzkoa",2020-08-31,7490,322,7,1371,195.9,7,1
"Gipuzkoa",2020-09-07,8765,328,7,1275,182.1,6,0.9
"Gipuzkoa",2020-09-14,9982,340,7,1217,173.9,12,1.7
"Gipuzkoa",2020-09-21,11131,368,7,1149,164.1,28,4
......@@ -69,10 +68,10 @@
"Gipuzkoa",2020-12-27,39435,825,7,785,112.1,22,3.1
"Gipuzkoa",2021-01-03,40474,859,7,1039,148.4,34,4.9
"Gipuzkoa",2021-01-10,41674,892,7,1200,171.4,33,4.7
"Gipuzkoa",2021-01-17,43661,922,7,1987,283.9,30,4.3
"Gipuzkoa",2021-01-27,45099,941,10,1438,143.8,19,1.9
"Araba/Álava",2020-05-25,5070,NA,NA,NA,NA,NA,NA
"Araba/Álava",2020-06-01,5151,NA,7,81,11.6,NA,NA
"Gipuzkoa",2021-01-17,43155,914,7,1481,211.6,22,3.1
"Gipuzkoa",2021-01-24,45099,941,7,1944,277.7,27,3.9
"Gipuzkoa",2021-01-31,47320,973,7,2221,317.3,32,4.6
"Araba/Álava",2020-06-01,5151,NA,NA,NA,NA,NA,NA
"Araba/Álava",2020-06-08,5247,NA,7,96,13.7,NA,NA
"Araba/Álava",2020-06-15,5301,370,7,54,7.7,NA,NA
"Araba/Álava",2020-06-22,5350,370,7,49,7,0,0
......@@ -105,10 +104,10 @@
"Araba/Álava",2020-12-27,18460,568,7,413,59,15,2.1
"Araba/Álava",2021-01-03,18942,579,7,482,68.9,11,1.6
"Araba/Álava",2021-01-10,19464,595,7,522,74.6,16,2.3
"Araba/Álava",2021-01-17,21135,610,7,1671,238.7,15,2.1
"Araba/Álava",2021-01-27,21234,611,10,99,9.9,1,0.1
"Otros",2020-05-25,169,NA,NA,NA,NA,NA,NA
"Otros",2020-06-01,173,NA,7,4,0.6,NA,NA
"Araba/Álava",2021-01-17,20185,598,7,721,103,3,0.4
"Araba/Álava",2021-01-24,21234,611,7,1049,149.9,13,1.9
"Araba/Álava",2021-01-31,22337,621,7,1103,157.6,10,1.4
"Otros",2020-06-01,173,NA,NA,NA,NA,NA,NA
"Otros",2020-06-08,174,NA,7,1,0.1,NA,NA
"Otros",2020-06-15,177,1,7,3,0.4,NA,NA
"Otros",2020-06-22,178,1,7,1,0.1,0,0
......@@ -142,4 +141,5 @@
"Otros",2021-01-03,675,NA,7,11,1.6,NA,NA
"Otros",2021-01-10,687,NA,7,12,1.7,NA,NA
"Otros",2021-01-17,700,NA,7,13,1.9,NA,NA
"Otros",2021-01-27,743,NA,10,43,4.3,NA,NA
"Otros",2021-01-24,743,NA,7,43,6.1,NA,NA
"Otros",2021-01-31,794,NA,7,51,7.3,NA,NA
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