Italy's socio-demographics visualization app

Today is 2019-02-22

The aim of this Shiny app is to look at some Italy's socio-demographic features at a regional level of 2017. The data have been collected by ISTAT (National Institute of Statistics) in 2017 and are available at http://demo.istat.it. In Italy there are 20 regions and at 31/12/2017 a total population of 6.048397310^{7}

The app shows a map of Italy in which each region is coloured by the selected socio-demographic feature. Furthermore if the user is interested in, the app can show a datatable with values by region of one or more features that are in the data.

Feature in the dataset (part1)

  • Region: name of each Italian region
  • Pop_tot_31dec: Italian Population at 31/12/2017
  • Pop_male_31dec: Italian Male Population at 31/12/2017
  • Pop_female_31dec: Italian Female Population at 31/12/2017
  • Pop_male_31dec_perc: % Italian Male Population at 31/12/2017
  • Pop_female_31dec_perc: % Italian Female Population at 31/12/2017
  • Number_of_families: Number of families
  • Number_of_cohabitations: Number of cohabitations
  • Avg_num_components: Average number of family components
  • male_life_expectancy_2017: Life expectancy of Males

Feature in the dataset (part2)

  • female_life_expectancy_2017: Life expectancy of Females
  • tot_life_expectancy_2017: Life expectancy (Males+Females)
  • quoz_nat_2017: Birth rate
  • quoz_death_2017: Death rate
  • quoz_marriages_2017: Marriage rate
  • fertility_rate_2017: Fertility rate
  • age_avg_childbirth_2017: Average age of women at first childbirth

Each feature is easily recognizable in the app by its label. At http://demo.istat.it/bil2017/index03.html and http://demo.istat.it/altridati/indicatori/index.html the user can find the official description of each feature (in Italian).

FEATURE READ IN

Here an example of read in of some feature:

library(tidyverse)

regioni1 <- read_csv("regioni.csv", col_names = FALSE, 
    skip = 1)
regioni1 <- regioni1[, c(1, 44:49)]
names(regioni1) <- c("regione", "Pop_male_31dec", 
    "Pop_female_31dec", "Pop_tot_31dec", 
    "Number_of_families", "Number_of_cohabitations", 
    "Avg_num_components")

FEATURE READ IN

regioni1 <- regioni1 %>% mutate(regione = str_replace_all(regione, 
    c(`Trentino Alto Adige` = "Trentino-Alto Adige", 
        `Friuli Venezia Giulia` = "Friuli-Venezia Giulia", 
        `Emilia Romagna` = "Emilia-Romagna", 
        `Valle D'Aosta` = "Valle d'Aosta")), 
    Pop_male_31dec_perc = round((Pop_male_31dec/Pop_tot_31dec) * 
        100, 2), Pop_female_31dec_perc = round((Pop_female_31dec/Pop_tot_31dec) * 
        100, 2))

FEATURE READ IN

Output:

head(regioni1[,c(1:3)])
## # A tibble: 6 x 3
##   regione             Pop_male_31dec Pop_female_31dec
##   <chr>                        <dbl>            <dbl>
## 1 Piemonte                   2123610          2252255
## 2 Valle d'Aosta                61695            64507
## 3 Liguria                     743755           813226
## 4 Lombardia                  4907685          5128573
## 5 Trentino-Alto Adige         525523           542125
## 6 Veneto                     2395801          2509236

USAGE EXPLANATION (part1)

When it starts, the app shows in the sidebar panel the feature selection for the map (that appears on the main panel on the right). By default the app selects "region name" as feature and colours the respective region.

If the user selects another feature, the app shows another input widget in which the user can decide the colour (palette) of the map. With "Region name" there isn't this possibility.

USAGE EXPLANATION (part2)

Under the feature selection there is a tick box "Show data table" to show a data table. If it's marked, then the app shows a checkbox with all the features available in the data. The user can select how many feature he wants to be shown in the table. The table is shown when the user finally press the button "Show".

At the moment the user needs to press the button "Show" to refresh the datatable even if he/she marks or unmarks the tick box "Show data table".

SERVER function