Sys.Date()
## [1] "2020-10-25"

The numbers of infection have increased in the past days to require further restrictions in movements and a lockdown to 6pm for public services such as bars and restaurants; gyms and high level schools are required to perform on-line as a distance learning.

The follow analytics summarise the impact of new infections in months since the begin of this Panademic outbreak:

library(dplyr)
library(tidyverse)
library(tidyr)
library(deSolve)
library(reader)
library(formattable)
library(ggplot2)
library(lubridate)

customGreen0 = "#DeF7E9"
customGreen = "#71CA97"
customRed = "#ff7f7f"

Source of data are from : githubusercontent.com/pcm-dpc/COVID-19

it_regions<-read.csv("https://raw.githubusercontent.com/pcm-dpc/COVID-19/master/dati-regioni/dpc-covid19-ita-regioni.csv")

IT_regions<- read.csv("input_data/coronavirus_it_regions.csv")
IT_regions<-formattable(IT_regions)
head(IT_regions)
date state regions recovered ICU hospidalized_tot isolation positives new_positives deaths cases new_cases new_deaths days_since_death10 days_since_case100
2020-02-24T18:00:00 ITA Abruzzo 0 0 0 0 0 0 0 0 0 0 0 0
2020-02-25T18:00:00 ITA Abruzzo 0 0 0 0 0 0 0 0 0 0 0 0
2020-02-26T18:00:00 ITA Abruzzo 0 0 0 0 0 0 0 0 0 0 0 0
2020-02-27T18:00:00 ITA Abruzzo 0 0 1 0 1 1 0 1 1 0 0 0
2020-02-28T18:00:00 ITA Abruzzo 0 0 1 0 1 0 0 1 0 0 0 0
2020-02-29T17:00:00 ITA Abruzzo 0 0 2 0 2 1 0 2 1 0 0 0
IT_regions$date =as.Date(IT_regions$date)

it_cfr<-IT_regions%>%mutate(CFR=deaths/cases)%>%
  group_by(regions)%>%
  summarise(round(mean(cases)),round(mean(deaths)),round(mean(CFR,na.rm=TRUE),2))

names(it_cfr)=c("regions","avg_cases","avg_deaths","CFR" )

formattable(it_cfr, 
            align =c("l","c","c","r"), 
            list(`Indicator Name` = formatter(
              "span", style = ~ style(color = "grey",font.weight = "bold")),
              `CFR` = color_bar(customRed)
            ))
regions avg_cases avg_deaths CFR
Abruzzo 3059 360 0.11
Basilicata 449 23 0.05
Calabria 1219 80 0.06
Campania 6312 355 0.06
Emilia-Romagna 25677 3513 0.13
Friuli Venezia Giulia 3155 279 0.08
Lazio 8785 646 0.07
Liguria 8959 1229 0.13
Lombardia 80782 13661 0.16
Marche 6096 823 0.13
Molise 414 19 0.05
P.A. Bolzano 2485 241 0.09
P.A. Trento 4168 349 0.08
Piemonte 26491 3189 0.11
Puglia 4583 435 0.09
Sardegna 1784 110 0.07
Sicilia 3793 234 0.06
Toscana 9939 879 0.08
Umbria 1591 66 0.04
Valle d’Aosta 1063 120 0.11
Veneto 18522 1611 0.08
it_month<-IT_regions%>%
  mutate(month = format(date, "%m"),CFR=deaths/cases)%>%
  group_by(month)%>%
  summarise(round(mean(cases)),round(mean(deaths)),round(mean(CFR,na.rm=TRUE)*100,2))


names(it_month)=c("month","avg_cases","avg_deaths","CFR" )

it_month<-formattable(it_month)

improvement_formatter <- 
  formatter("span", 
            style = x ~ style(
              font.weight = "bold", 
              color = ifelse(x > 0, customRed, ifelse(x < 0, customGreen, "black"))))

formattable(it_month, 
            align =c("l","c","c","r"), 
            list(`Indicator Name` = formatter(
              "span", style = ~ style(color = "grey",font.weight = "bold")),
              #`CFR` = color_bar(customRed),
              `CFR` = improvement_formatter
))
month avg_cases avg_deaths CFR
02 29 1 0.61
03 1858 179 3.84
04 7823 1022 9.15
05 10622 1496 10.44
06 11294 1633 10.89
07 11614 1667 10.83
08 12165 1682 10.22
09 13888 1698 8.64
10 18084 1731 6.74
cfr<-it_month$CFR
plot(cfr,type="o",col="red")

it_month<-as.data.frame(it_month)
require(ggplot2)
g<-ggplot(it_month,aes(month,CFR))
g+geom_point()

hist(it_month$CFR)