# Introduction to the covid19italy Datasets

The covid19italy R package provides a tidy format dataset of the 2019 Novel Coronavirus COVID-19 (2019-nCoV) pandemic outbreak in Italy. The package includes the following three datasets:

- `italy_total` - daily summary of the outbreak on the national level
- `italy_region` - daily summary of the outbreak on the region level
- `italy_province` - daily summary of the outbreak on the province level

The data was pull from Italy Department of Civil Protection

## Installation

You can install the released version of covid19italy from CRAN with:

    install.packages("covid19italy")

Or, install the most recent version from GitHub with:

    # install.packages("devtools")
    devtools::install_github("RamiKrispin/covid19Italy")

## Data refresh

The covid19italy package dev version is been updated on a daily bases. The `update_data` function enables a simple refresh of the installed package datasets with the most updated version on Github:

    library(covid19italy)

    update_data()

Note: must restart the R session to have the updates available

## Italy summary

The `italy_total` dataset provides an overall summary of the cases in Italy since the beginning of the covid19 outbreak since February 24, 2020. The dataset contains the following fields:

- `date` - timestamp, a `Date` object
- `hospitalized_with_symptoms` - daily number of patients hospitalized with symptoms
- `intensive_care` - daily number of patients on intensive care
- `total_hospitalized` - daily total number of patients hospitalized (`hospitalized_with_symptoms` + `intensive_care`)
- `home_confinement` - daily number of people under home confinement
- `cumulative_positive_cases` - a daily snapshot of the number of positive cases
- `daily_positive_cases` - daily new positive cases
- `daily_cases` - daily new positive, recovered, and death cases
- `recovered` - total number of recovered cases (cumulative)
- `death` - total number of death cases (cumulative)
- `positive_clinical_activity` - positive cases emerged from clinical activity
- `positive_surveys_tests` - positive cases emerging from surveys and tests, planned at national or regional level
- `cumulative_cases` - total number of positive cases (cumulative)
- `total_tests` - total number of tests performed (cumulative)

    library(covid19italy)

    data(italy_total)

    str(italy_total)
    #> 'data.frame':    148 obs. of  14 variables:
    #>  $ date                      : Date, format: "2020-02-24" "2020-02-25" ...
    #>  $ hospitalized_with_symptoms: int  101 114 128 248 345 401 639 742 1034 1346 ...
    #>  $ intensive_care            : int  26 35 36 56 64 105 140 166 229 295 ...
    #>  $ total_hospitalized        : int  127 150 164 304 409 506 779 908 1263 1641 ...
    #>  $ home_confinement          : int  94 162 221 284 412 543 798 927 1000 1065 ...
    #>  $ cumulative_positive_cases : int  221 311 385 588 821 1049 1577 1835 2263 2706 ...
    #>  $ daily_positive_cases      : int  0 90 74 203 233 228 528 258 428 443 ...
    #>  $ recovered                 : int  1 1 3 45 46 50 83 149 160 276 ...
    #>  $ death                     : int  7 10 12 17 21 29 34 52 79 107 ...
    #>  $ positive_clinical_activity: int  NA NA NA NA NA NA NA NA NA NA ...
    #>  $ positive_surveys_tests    : int  NA NA NA NA NA NA NA NA NA NA ...
    #>  $ cumulative_cases          : int  229 322 400 650 888 1128 1694 2036 2502 3089 ...
    #>  $ total_tests               : int  4324 8623 9587 12014 15695 18661 21127 23345 25856 29837 ...
    #>  $ total_people_tested       : int  NA NA NA NA NA NA NA NA NA NA ...

    head(italy_total)
    #>         date hospitalized_with_symptoms intensive_care total_hospitalized
    #> 1 2020-02-24                        101             26                127
    #> 2 2020-02-25                        114             35                150
    #> 3 2020-02-26                        128             36                164
    #> 4 2020-02-27                        248             56                304
    #> 5 2020-02-28                        345             64                409
    #> 6 2020-02-29                        401            105                506
    #>   home_confinement cumulative_positive_cases daily_positive_cases recovered
    #> 1               94                       221                    0         1
    #> 2              162                       311                   90         1
    #> 3              221                       385                   74         3
    #> 4              284                       588                  203        45
    #> 5              412                       821                  233        46
    #> 6              543                      1049                  228        50
    #>   death positive_clinical_activity positive_surveys_tests cumulative_cases
    #> 1     7                         NA                     NA              229
    #> 2    10                         NA                     NA              322
    #> 3    12                         NA                     NA              400
    #> 4    17                         NA                     NA              650
    #> 5    21                         NA                     NA              888
    #> 6    29                         NA                     NA             1128
    #>   total_tests total_people_tested
    #> 1        4324                  NA
    #> 2        8623                  NA
    #> 3        9587                  NA
    #> 4       12014                  NA
    #> 5       15695                  NA
    #> 6       18661                  NA

## Italy region level

The `italy_region` dataset provides an overall summary of the cases in Italy’s regions. The dataset contains the following fields:

- `date` - timestamp, a `Date` object
- `region_code` - the region code
- `region_name` - the region name
- `lat` - region latitude coordinate
- `long` - region longitude coordinate
- `hospitalized_with_symptoms` - daily number of patients hospitalized with symptoms
- `intensive_care` - daily number of patients on intensive care
- `total_hospitalized` - daily total number of patients hospitalized (`hospitalized_with_symptoms` + `intensive_care`)
- `home_confinement` - daily number of people under home confinement
- `cumulative_positive_cases` - a daily snapshot of the number of positive cases
- `daily_positive_cases` - daily new positive cases
- `daily_cases` - daily new positive, recovered, and death cases
- `recovered` - total number of recovered cases (cumulative)
- `death` - total number of death cases (cumulative)
- `positive_clinical_activity` - positive cases emerged from clinical activity
- `positive_surveys_tests` - positive cases emerging from surveys and tests, planned at national or regional level
- `cumulative_cases` - total number of positive cases, recovered, and death (cumulative)
- `total_tests` - total number of tests performed (cumulative)
- `region_spatial` - the spatial region names as in the output of the `ne_states` function from the rnaturalearth package

    data(italy_region)

    str(italy_region)
    #> 'data.frame':    3108 obs. of  19 variables:
    #>  $ date                      : Date, format: "2020-02-24" "2020-02-24" ...
    #>  $ region_code               : int  13 17 18 15 8 6 12 7 3 11 ...
    #>  $ region_name               : chr  "Abruzzo" "Basilicata" "Calabria" "Campania" ...
    #>  $ lat                       : num  42.4 40.6 38.9 40.8 44.5 ...
    #>  $ long                      : num  13.4 15.8 16.6 14.3 11.3 ...
    #>  $ hospitalized_with_symptoms: int  0 0 0 0 10 0 1 0 76 0 ...
    #>  $ intensive_care            : int  0 0 0 0 2 0 1 0 19 0 ...
    #>  $ total_hospitalized        : int  0 0 0 0 12 0 2 0 95 0 ...
    #>  $ home_confinement          : int  0 0 0 0 6 0 0 0 71 0 ...
    #>  $ cumulative_positive_cases : int  0 0 0 0 18 0 2 0 166 0 ...
    #>  $ daily_positive_cases      : int  0 0 0 0 0 0 0 0 0 0 ...
    #>  $ recovered                 : int  0 0 0 0 0 0 1 0 0 0 ...
    #>  $ death                     : int  0 0 0 0 0 0 0 0 6 0 ...
    #>  $ positive_clinical_activity: int  NA NA NA NA NA NA NA NA NA NA ...
    #>  $ positive_surveys_tests    : int  NA NA NA NA NA NA NA NA NA NA ...
    #>  $ cumulative_cases          : int  0 0 0 0 18 0 3 0 172 0 ...
    #>  $ total_tests               : int  5 0 1 10 148 58 124 1 1463 16 ...
    #>  $ total_people_tested       : int  NA NA NA NA NA NA NA NA NA NA ...
    #>  $ region_spatial            : chr  "Abruzzo" "Basilicata" "Calabria" "Campania" ...

    head(italy_region)
    #>         date region_code           region_name      lat     long
    #> 1 2020-02-24          13               Abruzzo 42.35122 13.39844
    #> 2 2020-02-24          17            Basilicata 40.63947 15.80515
    #> 3 2020-02-24          18              Calabria 38.90598 16.59440
    #> 4 2020-02-24          15              Campania 40.83957 14.25085
    #> 5 2020-02-24           8        Emilia-Romagna 44.49437 11.34172
    #> 6 2020-02-24           6 Friuli Venezia Giulia 45.64944 13.76814
    #>   hospitalized_with_symptoms intensive_care total_hospitalized home_confinement
    #> 1                          0              0                  0                0
    #> 2                          0              0                  0                0
    #> 3                          0              0                  0                0
    #> 4                          0              0                  0                0
    #> 5                         10              2                 12                6
    #> 6                          0              0                  0                0
    #>   cumulative_positive_cases daily_positive_cases recovered death
    #> 1                         0                    0         0     0
    #> 2                         0                    0         0     0
    #> 3                         0                    0         0     0
    #> 4                         0                    0         0     0
    #> 5                        18                    0         0     0
    #> 6                         0                    0         0     0
    #>   positive_clinical_activity positive_surveys_tests cumulative_cases
    #> 1                         NA                     NA                0
    #> 2                         NA                     NA                0
    #> 3                         NA                     NA                0
    #> 4                         NA                     NA                0
    #> 5                         NA                     NA               18
    #> 6                         NA                     NA                0
    #>   total_tests total_people_tested        region_spatial
    #> 1           5                  NA               Abruzzo
    #> 2           0                  NA            Basilicata
    #> 3           1                  NA              Calabria
    #> 4          10                  NA              Campania
    #> 5         148                  NA        Emilia-Romagna
    #> 6          58                  NA Friuli-Venezia Giulia

## Italy province level

The `italy_region` dataset provides an overall summary of the cases in Italy’s regions. The dataset contains the following fields:

- `date` - timestamp, a `Date` object
- `region_code` - the region code
- `region_name` - the region name
- `province_code` - the province code
- `province_name` - the province name
- `province_abb` - the province abbreviation
- `lat` - province latitude coordinate
- `long` - province longitude coordinate
- `total_cases` - total number of positive cases (cumulative)
- `new_tests` - daily number of positive cases
- `province_spatial` - the spatial province names as in the output of the `ne_states` function from the rnaturalearth package

    data(italy_province)

    str(italy_province)
    #> 'data.frame':    19490 obs. of  11 variables:
    #>  $ date            : Date, format: "2020-02-24" "2020-02-24" ...
    #>  $ region_code     : int  13 13 13 13 13 17 17 17 18 18 ...
    #>  $ region_name     : chr  "Abruzzo" "Abruzzo" "Abruzzo" "Abruzzo" ...
    #>  $ province_code   : int  66 67 68 69 979 76 77 980 78 79 ...
    #>  $ province_name   : chr  "L'Aquila" "Teramo" "Pescara" "Chieti" ...
    #>  $ province_abb    : chr  "AQ" "TE" "PE" "CH" ...
    #>  $ lat             : num  42.4 42.7 42.5 42.4 NA ...
    #>  $ long            : num  13.4 13.7 14.2 14.2 NA ...
    #>  $ total_cases     : int  0 0 0 0 0 0 0 0 0 0 ...
    #>  $ new_cases       : int  0 0 0 0 0 0 0 0 0 0 ...
    #>  $ province_spatial: chr  "L'Aquila" "Teramo" "Pescara" "Chieti" ...

    head(italy_province)
    #>         date region_code region_name province_code
    #> 1 2020-02-24          13     Abruzzo            66
    #> 2 2020-02-24          13     Abruzzo            67
    #> 3 2020-02-24          13     Abruzzo            68
    #> 4 2020-02-24          13     Abruzzo            69
    #> 5 2020-02-24          13     Abruzzo           979
    #> 6 2020-02-24          17  Basilicata            76
    #>                          province_name province_abb      lat     long
    #> 1                             L'Aquila           AQ 42.35122 13.39844
    #> 2                               Teramo           TE 42.65892 13.70440
    #> 3                              Pescara           PE 42.46458 14.21365
    #> 4                               Chieti           CH 42.35103 14.16755
    #> 5 In fase di definizione/aggiornamento                    NA       NA
    #> 6                              Potenza           PZ 40.63947 15.80515
    #>   total_cases new_cases                     province_spatial
    #> 1           0         0                             L'Aquila
    #> 2           0         0                               Teramo
    #> 3           0         0                              Pescara
    #> 4           0         0                               Chieti
    #> 5           0         0 In fase di definizione/aggiornamento
    #> 6           0         0                              Potenza