library(dplyr)
library(ggplot2)
library(reshape2)
library(tidyr)
library(knitr)
Da World Bank è possibile scaricare il tasso di crescita del PIL di Italia e Spagna dal 1960 al 2025: https://data.worldbank.org/indicator/NY.GDP.MKTP.KD.ZG?locations=OE
Dall’OCSE è possibile scaricare il salario medio annuo di Italia e Spagna dal 1960 al 2025: https://data-explorer.oecd.org/vis?tm=%22average%20annual%20wage%22&pg=0&snb=26&vw=tb&df[ds]=dsDisseminateFinalDMZ&df[id]=DSD_EARNINGS%40AV_AN_WAGE&df[ag]=OECD.ELS.SAE&df[vs]=1.0&dq=……&pd=2000,&to[TIME_PERIOD]=false&ly[cl]=TIME_PERIOD&ly[rw]=REF_AREA,PRICE_BASE
Caricamento dati:
options(scipen = 999)
GDP_growth <- read.csv("GDP_growth.csv")
PIL_procapite <- read.csv("estat_nama_10_pc_en_PIL_procapite.csv")
Tasso_occupazione <- read.csv("estat_lfsi_emp_a_en_Occupazione.csv")
Tasso_disoccupazione <- read.csv("estat_une_rt_a_en_Disoccupazione.csv")
Tasso_povertà <- read.csv("estat_ilc_li02_en_Rischio_povertà .csv")
Salario_medio_annuo <- read.csv("Average annual wages.csv")
Salario_minimo <- read.csv("Real minimum wages at constant prices.csv")
Immigrazione <- read.csv("estat_migr_imm8_en_Immigrazione.csv")
Permessi_soggiorno <- read.csv("estat_migr_resfirst_en_Nuovi permessi rilasciati ogni anno.csv")
Reati_denunciati <- read.csv("estat_crim_off_cat_en_Reati denunciati alla polizia per categoria.csv")
df<-GDP_growth %>%
filter(Country.Name %in% c("Italy","Spain")) %>%
select(1,5:70)
colnames(df)[2:67] <- 1960:2025
df <- melt(df, id="Country.Name")
df$variable <- as.integer(as.character(df$variable))
df %>%
mutate(Country.Name=factor(Country.Name,levels = c("Spain","Italy"))) %>%
filter(variable>2016) %>%
ggplot(aes(variable,value, colour = Country.Name)) +
geom_line(linewidth = 1)+
scale_y_continuous(breaks = -15:10)+
scale_x_continuous(breaks = 2017:2025)+
geom_text(aes(label=round(value,2)), vjust=-1, size=3)+
# Linee verticali
geom_vline(xintercept = 2018, linetype = "dashed", colour = "blue") +
geom_vline(xintercept = 2022, linetype = "dashed", colour = "red") +
# Etichette
annotate("text",
x = 2018,
y = Inf,
label = "Sánchez",
angle = 90,
vjust = -0.5,
hjust = 1.5,
colour = "blue") +
annotate("text",
x = 2022,
y = Inf,
label = "Meloni",
angle = 90,
vjust = -0.5,
hjust = 1.5,
colour = "red") +
xlab("Anno")+
ylab("Tasso di crescita del PIL")+
ggtitle("Tasso di crescita del PIL in Italia e Spagna dal 2017 al 2025")
df<-PIL_procapite %>%
filter(geo %in% c("IT","ES"))
df %>%
filter(TIME_PERIOD>2016, unit=="CP_EUR_HAB", na_item=="B1GQ") %>%
ggplot(aes(TIME_PERIOD, OBS_VALUE, colour = geo)) +
geom_line(linewidth = 1)+
geom_text(aes(label=OBS_VALUE), vjust=-1, size=3)+
scale_x_continuous(breaks = 2017:2025)+
# Linee verticali
geom_vline(xintercept = 2018, linetype = "dashed", colour = "blue") +
geom_vline(xintercept = 2022, linetype = "dashed", colour = "red") +
# Etichette
annotate("text",
x = 2018,
y = Inf,
label = "Sánchez",
angle = 90,
vjust = -0.5,
hjust = 1.5,
colour = "blue") +
annotate("text",
x = 2022,
y = Inf,
label = "Meloni",
angle = 90,
vjust = -0.5,
hjust = 1.5,
colour = "red") +
xlab("Anno")+
ylab("PIL procapite in euro")+
ggtitle("PIL procapite in euro al prezzo corrente", subtitle = "in Italia e Spagna dal 2017 al 2025")
df<-Tasso_occupazione %>%
filter(geo %in% c("IT","ES"))
df %>%
filter(TIME_PERIOD>2016, unit=="PC_POP", age=="Y20-64", sex=="T", indic_em=="EMP_LFS") %>%
ggplot(aes(TIME_PERIOD, OBS_VALUE, colour = geo)) +
geom_line(linewidth = 1)+
geom_text(aes(label=OBS_VALUE), vjust=-1, size=3)+
scale_x_continuous(breaks = 2017:2025)+
# Linee verticali
geom_vline(xintercept = 2018, linetype = "dashed", colour = "blue") +
geom_vline(xintercept = 2022, linetype = "dashed", colour = "red") +
# Etichette
annotate("text",
x = 2018,
y = Inf,
label = "Sánchez",
angle = 90,
vjust = -0.5,
hjust = 1.5,
colour = "blue") +
annotate("text",
x = 2022,
y = Inf,
label = "Meloni",
angle = 90,
vjust = -0.5,
hjust = 1.5,
colour = "red") +
xlab("Anno")+
ylab("Tasso di occupazione")+
ggtitle("Percentuale della popolazione occupata dai 20 ai 64 anni", subtitle = "in Italia e Spagna dal 2017 al 2025")
df<-Tasso_disoccupazione %>%
filter(geo %in% c("IT","ES"))
df %>%
filter(TIME_PERIOD>2016, unit=="PC_POP", age=="Y20-64", sex=="T") %>%
ggplot(aes(TIME_PERIOD, OBS_VALUE, colour = geo)) +
geom_line(linewidth = 1)+
geom_text(aes(label=OBS_VALUE), vjust=-1, size=3)+
scale_x_continuous(breaks = 2017:2025)+
# Linee verticali
geom_vline(xintercept = 2018, linetype = "dashed", colour = "blue") +
geom_vline(xintercept = 2022, linetype = "dashed", colour = "red") +
# Etichette
annotate("text",
x = 2018,
y = Inf,
label = "Sánchez",
angle = 90,
vjust = -0.5,
hjust = 1.5,
colour = "blue") +
annotate("text",
x = 2022,
y = Inf,
label = "Meloni",
angle = 90,
vjust = -0.5,
hjust = 1.5,
colour = "red") +
xlab("Anno")+
ylab("Tasso di occupazione")+
ggtitle("Percentuale della popolazione disoccupata dai 20 ai 64 anni", subtitle = "in Italia e Spagna dal 2017 al 2025")
df<-Tasso_povertà %>%
filter(geo %in% c("IT","ES"))
df %>%
filter(TIME_PERIOD>2016, unit=="PC", sex=="T", age=="TOTAL", rskpovth=="B_60", statinfo=="MED_EI") %>%
ggplot(aes(TIME_PERIOD, OBS_VALUE, colour = geo)) +
geom_line(linewidth = 1)+
geom_text(aes(label=OBS_VALUE), vjust=-1, size=3)+
scale_x_continuous(breaks = 2017:2025)+
# Linee verticali
geom_vline(xintercept = 2018, linetype = "dashed", colour = "blue") +
geom_vline(xintercept = 2022, linetype = "dashed", colour = "red") +
# Etichette
annotate("text",
x = 2018,
y = Inf,
label = "Sánchez",
angle = 90,
vjust = -0.5,
hjust = 1.5,
colour = "blue") +
annotate("text",
x = 2022,
y = Inf,
label = "Meloni",
angle = 90,
vjust = -0.5,
hjust = 1.5,
colour = "red") +
xlab("Anno")+
ylab("Tasso di occupazione")+
ggtitle("Percentuale della popolazione che vive al di sotto", subtitle = " del 60% del reddito mediano in Italia e Spagna dal 2017 al 2025")
df<-Salario_medio_annuo %>%
filter(Reference.area %in% c("Spain","Italy"))
df %>%
mutate(Reference.area=factor(Reference.area, levels = c("Spain","Italy"))) %>%
filter(TIME_PERIOD>2016,Unit.of.measure=="Euro" , Price.base=="Constant prices") %>%
ggplot(aes(TIME_PERIOD, OBS_VALUE, colour = Reference.area)) +
geom_line(linewidth = 1)+
geom_text(aes(label=round(OBS_VALUE,2)), vjust=-1, size=3)+
scale_x_continuous(breaks = 2017:2025)+
# Linee verticali
geom_vline(xintercept = 2018, linetype = "dashed", colour = "blue") +
geom_vline(xintercept = 2022, linetype = "dashed", colour = "red") +
# Etichette
annotate("text",
x = 2018,
y = Inf,
label = "Sánchez",
angle = 90,
vjust = -0.5,
hjust = 1.5,
colour = "blue") +
annotate("text",
x = 2022,
y = Inf,
label = "Meloni",
angle = 90,
vjust = -0.5,
hjust = 1.5,
colour = "red") +
xlab("Anno")+
ylab("Salario medio annuo")+
ggtitle("Salario medio annuo in euro al prezzo costante", subtitle = "in Italia e Spagna dal 2017 al 2025")
df<-Salario_minimo %>%
filter(Reference.area == "Spain", TIME_PERIOD>2016,Unit.of.measure=="US dollars, exchange rate converted" , Price.base=="Constant prices") %>%
select(TIME_PERIOD, OBS_VALUE, Reference.area)
df1 <- data.frame(TIME_PERIOD=2017:2024, OBS_VALUE=0, Reference.area="Italy")
df <- rbind(df,df1)
df %>%
mutate(Reference.area=factor(Reference.area, levels = c("Spain","Italy"))) %>%
ggplot(aes(TIME_PERIOD, OBS_VALUE, colour = Reference.area)) +
geom_line(linewidth = 1)+
geom_text(aes(label=round(OBS_VALUE,2)), vjust=-1, size=3)+
ylim(0,18000)+
scale_x_continuous(breaks = 2017:2025)+
# Linee verticali
geom_vline(xintercept = 2018, linetype = "dashed", colour = "blue") +
geom_vline(xintercept = 2022, linetype = "dashed", colour = "red") +
# Etichette
annotate("text",
x = 2018,
y = Inf,
label = "Sánchez",
angle = 90,
vjust = -0.5,
hjust = 1.5,
colour = "blue") +
annotate("text",
x = 2022,
y = Inf,
label = "Meloni",
angle = 90,
vjust = -0.5,
hjust = 2,
colour = "red") +
xlab("Anno")+
ylab("Salario minimo")+
ggtitle("Salario minimo annuo in dollari USA al prezzo costante", subtitle = "in Italia e Spagna dal 2017 al 2024")
df<-Immigrazione %>%
filter(geo %in% c("IT","ES"))
df %>%
filter(TIME_PERIOD>2016, sex=="T", age=="TOTAL") %>%
ggplot(aes(TIME_PERIOD, OBS_VALUE, colour = geo)) +
geom_line(linewidth = 1)+
geom_text(aes(label=OBS_VALUE), vjust=-1, size=3)+
scale_x_continuous(breaks = 2017:2025)+
# Linee verticali
geom_vline(xintercept = 2018, linetype = "dashed", colour = "blue") +
geom_vline(xintercept = 2022, linetype = "dashed", colour = "red") +
# Etichette
annotate("text",
x = 2018,
y = Inf,
label = "Sánchez",
angle = 90,
vjust = -0.5,
hjust = 1.5,
colour = "blue") +
annotate("text",
x = 2022,
y = Inf,
label = "Meloni",
angle = 90,
vjust = -0.5,
hjust = 1.5,
colour = "red") +
xlab("Anno")+
ylab("Numero di immigrati")+
ggtitle("Numero di immigrati arrivati in Italia e Spagna dal 2017 al 2024")
df<-Permessi_soggiorno %>%
filter(geo %in% c("IT","ES"))
df %>%
filter(TIME_PERIOD>2016, duration =="TOTAL", reason=="TOTAL", citizen=="TOTAL") %>%
ggplot(aes(TIME_PERIOD, OBS_VALUE, colour = geo)) +
geom_line(linewidth = 1)+
geom_text(aes(label=OBS_VALUE), vjust=-1, size=3)+
scale_x_continuous(breaks = 2017:2025)+
# Linee verticali
geom_vline(xintercept = 2018, linetype = "dashed", colour = "blue") +
geom_vline(xintercept = 2022, linetype = "dashed", colour = "red") +
# Etichette
annotate("text",
x = 2018,
y = Inf,
label = "Sánchez",
angle = 90,
vjust = -0.5,
hjust = 1.5,
colour = "blue") +
annotate("text",
x = 2022,
y = Inf,
label = "Meloni",
angle = 90,
vjust = -0.5,
hjust = 1.5,
colour = "red") +
xlab("Anno")+
ylab("Numero di permessi di soggiorno")+
ggtitle("Nuovi permessi di soggiorno rilasciati ogni anno", subtitle = "in Italia e Spagna dal 2017 al 2025")
tabella_crimini <- Reati_denunciati %>%
filter(
geo %in% c("IT", "ES"),
unit == "P_HTHAB",
TIME_PERIOD >= 2018,
TIME_PERIOD <= 2025,
iccs %in% c(
"ICCS0101", # Omicidi
"ICCS0301", # Rapine
"ICCS0302", # Furti
"ICCS030221", # Furti in abitazione
"ICCS0501", # Furti d'auto
"ICCS0701", # Reati di droga
"ICCS09051" # Traffico di migranti
)
) %>%
mutate(
reato = recode(
iccs,
"ICCS0101" = "Omicidi",
"ICCS0301" = "Rapine",
"ICCS0302" = "Furti",
"ICCS030221" = "Furti_abitazione",
"ICCS0501" = "Furti_auto",
"ICCS0701" = "Reati_droga",
"ICCS09051" = "Traffico_migranti"
)
) %>%
select(geo, TIME_PERIOD, reato, OBS_VALUE) %>%
pivot_wider(
names_from = reato,
values_from = OBS_VALUE
) %>%
arrange(geo, TIME_PERIOD)
kable(tabella_crimini)
| geo | TIME_PERIOD | Omicidi | Rapine | Furti | Furti_abitazione | Furti_auto | Reati_droga | Traffico_migranti |
|---|---|---|---|---|---|---|---|---|
| ES | 2018 | 0.62 | 24.89 | 3.02 | 1.91 | 301.17 | 619.78 | 3.05 |
| ES | 2019 | 0.71 | 27.76 | 3.16 | 1.85 | 280.43 | 697.99 | 2.48 |
| ES | 2020 | 0.63 | 23.48 | 2.81 | 1.61 | 282.48 | 761.74 | 2.78 |
| ES | 2021 | 0.61 | 30.35 | 5.55 | 1.56 | 269.15 | 787.14 | 3.52 |
| ES | 2022 | 0.69 | 34.31 | 5.73 | 1.49 | 313.52 | 982.52 | 4.29 |
| ES | 2023 | 0.69 | 38.22 | 7.16 | 1.89 | 314.72 | 1109.23 | 4.25 |
| ES | 2024 | 0.72 | 40.43 | 6.56 | NA | 293.27 | 1063.91 | 5.61 |
| IT | 2018 | 0.59 | 8.90 | 3.61 | 1.04 | NA | 361.86 | 1.02 |
| IT | 2019 | 0.53 | 9.03 | 3.88 | 1.38 | NA | 466.35 | 0.93 |
| IT | 2020 | 0.48 | 8.25 | 4.22 | 1.85 | NA | 593.02 | 1.01 |
| IT | 2021 | 0.51 | 9.73 | 4.33 | 2.10 | NA | 743.49 | 1.19 |
| IT | 2022 | 0.55 | 11.54 | 3.81 | 1.72 | NA | 694.90 | 0.75 |
| IT | 2023 | 0.57 | 11.43 | 3.19 | 1.39 | NA | 763.16 | 0.68 |
| IT | 2024 | 0.57 | 12.59 | 3.54 | NA | NA | 732.67 | 0.85 |