# 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)
    #> Classes 'tbl_df', 'tbl' and 'data.frame':    520 obs. of  19 variables:
    #>  $ date                             : Date, format: "2020-02-24" "2020-02-25" ...
    #>  $ hospitalized_with_symptoms       : num  101 114 128 248 345 ...
    #>  $ intensive_care                   : num  26 35 36 56 64 105 140 166 229 295 ...
    #>  $ total_hospitalized               : num  127 150 164 304 409 ...
    #>  $ home_confinement                 : num  94 162 221 284 412 ...
    #>  $ cumulative_positive_cases        : num  221 311 385 588 821 ...
    #>  $ daily_positive_cases             : num  0 90 74 203 233 228 528 258 428 443 ...
    #>  $ recovered                        : num  1 1 3 45 46 50 83 149 160 276 ...
    #>  $ death                            : num  7 10 12 17 21 29 34 52 79 107 ...
    #>  $ positive_clinical_activity       : num  NA NA NA NA NA NA NA NA NA NA ...
    #>  $ positive_surveys_tests           : num  NA NA NA NA NA NA NA NA NA NA ...
    #>  $ cumulative_cases                 : num  229 322 400 650 888 ...
    #>  $ total_tests                      : num  4324 8623 9587 12014 15695 ...
    #>  $ total_people_tested              : num  NA NA NA NA NA NA NA NA NA NA ...
    #>  $ new_intensive_care               : num  NA NA NA NA NA NA NA NA NA NA ...
    #>  $ total_positive_molecular_test    : num  NA NA NA NA NA NA NA NA NA NA ...
    #>  $ total_positive_rapid_antigen_test: num  NA NA NA NA NA NA NA NA NA NA ...
    #>  $ molecular_test                   : num  NA NA NA NA NA NA NA NA NA NA ...
    #>  $ rapid_antigen_test               : num  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 new_intensive_care
    #> 1        4324                  NA                 NA
    #> 2        8623                  NA                 NA
    #> 3        9587                  NA                 NA
    #> 4       12014                  NA                 NA
    #> 5       15695                  NA                 NA
    #> 6       18661                  NA                 NA
    #>   total_positive_molecular_test total_positive_rapid_antigen_test
    #> 1                            NA                                NA
    #> 2                            NA                                NA
    #> 3                            NA                                NA
    #> 4                            NA                                NA
    #> 5                            NA                                NA
    #> 6                            NA                                NA
    #>   molecular_test rapid_antigen_test
    #> 1             NA                 NA
    #> 2             NA                 NA
    #> 3             NA                 NA
    #> 4             NA                 NA
    #> 5             NA                 NA
    #> 6             NA                 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':    10920 obs. of  26 variables:
    #>  $ date                      : Date, format: "2020-02-24" "2020-02-24" ...
    #>  $ region_code               : chr  "13" "17" "18" "15" ...
    #>  $ 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: num  0 0 0 0 10 0 1 0 76 0 ...
    #>  $ intensive_care            : num  0 0 0 0 2 0 1 0 19 0 ...
    #>  $ total_hospitalized        : num  0 0 0 0 12 0 2 0 95 0 ...
    #>  $ home_confinement          : num  0 0 0 0 6 0 0 0 71 0 ...
    #>  $ cumulative_positive_cases : num  0 0 0 0 18 0 2 0 166 0 ...
    #>  $ daily_positive_cases      : num  0 0 0 0 0 0 0 0 0 0 ...
    #>  $ recovered                 : num  0 0 0 0 0 0 1 0 0 0 ...
    #>  $ death                     : num  0 0 0 0 0 0 0 0 6 0 ...
    #>  $ positive_clinical_activity: chr  "" "" "" "" ...
    #>  $ positive_surveys_tests    : chr  "" "" "" "" ...
    #>  $ cumulative_cases          : num  0 0 0 0 18 0 3 0 172 0 ...
    #>  $ total_tests               : num  5 0 1 10 148 ...
    #>  $ total_people_tested       : chr  "" "" "" "" ...
    #>  $ new_intensive_care        : chr  "" "" "" "" ...
    #>  $ total_positive_tests      : chr  "" "" "" "" ...
    #>  $ total_fast_tests          : chr  "" "" "" "" ...
    #>  $ daily_positive_tests      : chr  "" "" "" "" ...
    #>  $ daily_fast_tests          : chr  "" "" "" "" ...
    #>  $ nuts_code_1               : chr  "" "" "" "" ...
    #>  $ nuts_code_2               : chr  "" "" "" "" ...
    #>  $ 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          08        Emilia-Romagna 44.49437 11.34172
    #> 6 2020-02-24          06 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                                                                  0
    #> 2                                                                  0
    #> 3                                                                  0
    #> 4                                                                  0
    #> 5                                                                 18
    #> 6                                                                  0
    #>   total_tests total_people_tested new_intensive_care total_positive_tests
    #> 1           5
    #> 2           0
    #> 3           1
    #> 4          10
    #> 5         148
    #> 6          58
    #>   total_fast_tests daily_positive_tests daily_fast_tests nuts_code_1
    #> 1
    #> 2
    #> 3
    #> 4
    #> 5
    #> 6
    #>   nuts_code_2        region_spatial
    #> 1                           Abruzzo
    #> 2                        Basilicata
    #> 3                          Calabria
    #> 4                          Campania
    #> 5                    Emilia-Romagna
    #> 6             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)
    #> Classes 'tbl_df', 'tbl' and 'data.frame':    74918 obs. of  14 variables:
    #>  $ date            : Date, format: "2020-02-24" "2020-02-24" ...
    #>  $ region_name     : chr  "Abruzzo" "Abruzzo" "Abruzzo" "Abruzzo" ...
    #>  $ region_code     : chr  "13" "13" "13" "13" ...
    #>  $ province_name   : chr  "L'Aquila" "Teramo" "Pescara" "Chieti" ...
    #>  $ province_spatial: chr  "L'Aquila" "Teramo" "Pescara" "Chieti" ...
    #>  $ province_abb    : chr  "AQ" "TE" "PE" "CH" ...
    #>  $ province_code   : chr  "066" "067" "068" "069" ...
    #>  $ lat             : num  42.4 42.7 42.5 42.4 NA ...
    #>  $ long            : num  13.4 13.7 14.2 14.2 NA ...
    #>  $ new_cases       : num  0 0 0 0 0 0 0 0 0 0 ...
    #>  $ total_cases     : num  0 0 0 0 0 0 0 0 0 0 ...
    #>  $ nuts_code_1     : chr  "" "" "" "" ...
    #>  $ nuts_code_2     : chr  "" "" "" "" ...
    #>  $ nuts_code_3     : chr  "" "" "" "" ...

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