Newer
Older
group_by(eu_q_rank) %>%
summarise(value = sum(value)*0.000000001,
eu_ntile_name = first(eu_ntile_name)) %>%
ggplot(aes(x=eu_ntile_name, y=value)) +
geom_col(position = position_dodge(), fill=pal[1]) +
theme_minimal() +
theme(text=element_text(family="Liberation Sans Narrow")) +
labs(x="", y="Carbon footprint (MtCO2eq)") +
theme(axis.text.x = element_text(angle = 90)) +
scale_x_discrete(labels = c("D01","D02","D03","D04","D05","D06","D07","D08","D09","D10"))
p1 = dat_country_summary_by_eu_ntile %>%
filter(year == 2005) %>%
ggplot(aes(x=factor(eu_q_rank), y=pe_co2eq_kg)) +
geom_violin(aes(weight=total_fd_me), fill=pal[1], color=pal[1], alpha=0.5) +
geom_point( alpha=0.3) +
geom_segment(data=dat_country_summary_by_eu_ntile %>%
filter(year == 2005) %>%
group_by(eu_q_rank) %>%
summarise(pe_co2eq_kg = weighted.mean(pe_co2eq_kg,total_fd_me)),
aes(y=pe_co2eq_kg, yend=pe_co2eq_kg, x=eu_q_rank-0.3, xend=eu_q_rank+0.3), size=1.5) +
theme_minimal() +
theme(text=element_text(family="Liberation Sans Narrow")) +
labs(x="", y="Carbon intensity per expenditure (kgCO2eq/€)") +
theme(axis.text.x = element_text(angle = 90)) +
scale_x_discrete(labels = c("D01","D02","D03","D04","D05","D06","D07","D08","D09","D10"))
p2 = dat_country_summary_by_eu_ntile %>%
filter(year == 2005) %>%
ggplot(aes(x=factor(eu_q_rank), y=pe_energy_use_mj)) +
geom_violin(aes(weight=total_fd_me), fill=pal[1], color=pal[1], alpha=0.5) +
geom_point( alpha=0.3) +
geom_segment(data=dat_country_summary_by_eu_ntile %>%
filter(year == 2005) %>%
group_by(eu_q_rank) %>%
summarise(pe_energy_use_mj = weighted.mean(pe_energy_use_mj,total_fd_me)),
aes(y=pe_energy_use_mj, yend=pe_energy_use_mj, x=eu_q_rank-0.3, xend=eu_q_rank+0.3), size=1.5) +
theme_minimal() +
theme(text=element_text(family="Liberation Sans Narrow")) +
labs(x="", y="Energy intensity per expenditure (MJ/€)") +
theme(axis.text.x = element_text(angle = 90)) +
scale_x_discrete(labels = c("D01","D02","D03","D04","D05","D06","D07","D08","D09","D10"))
dat3 = dat_country_summary_by_eu_ntile %>%
filter(year == 2005) %>%
mutate(intensity_e_c = total_co2eq_kg*0.001/total_energy_use_tj)
p3 = dat3 %>%
ggplot(aes(x=factor(eu_q_rank), y=intensity_e_c)) +
geom_violin(aes(weight=total_energy_use_tj), fill=pal[1], color=pal[1], alpha=0.5) +
geom_point( alpha=0.3) +
geom_segment(data=dat3 %>%
filter(year == 2005) %>%
group_by(eu_q_rank) %>%
summarise(intensity_e_c = weighted.mean(intensity_e_c,total_energy_use_tj)),
aes(y=intensity_e_c, yend=intensity_e_c, x=eu_q_rank-0.3, xend=eu_q_rank+0.3), size=1.5) +
theme_minimal() +
theme(text=element_text(family="Liberation Sans Narrow")) +
labs(x="", y="Carbon intensity per energy (gCO2eq/TJ)") +
theme(axis.text.x = element_text(angle = 90)) +
scale_x_discrete(labels = c("D01","D02","D03","D04","D05","D06","D07","D08","D09","D10"))
```{r values-in-text-2005-ixi}
# values in text
## inequality
exp = pdat_country_summary_by_eu_ntile %>%
filter(year == 2005,
indicator == "total_fd_me") %>%
group_by(eu_q_rank) %>%
summarise(value = sum(value)*0.000001,
eu_ntile_name = first(eu_ntile_name))
exp_total = (exp %>% summarise(value = sum(value)))$value
exp_10_10 = round((exp %>% filter(eu_q_rank == 10))$value/(exp %>% filter(eu_q_rank == 1))$value,digits = 1)
energy = pdat_country_summary_by_eu_ntile %>%
filter(year == 2005,
indicator == "total_energy_use_tj") %>%
group_by(eu_q_rank) %>%
summarise(value = sum(value)*0.000001,
eu_ntile_name = first(eu_ntile_name))
energy_total = (energy %>% summarise(value = sum(value)))$value
energy_10_10 = round((energy %>% filter(eu_q_rank == 10))$value/(energy %>% filter(eu_q_rank == 1))$value,digits = 1)
co2eq = pdat_country_summary_by_eu_ntile %>%
filter(year == 2005,
indicator == "total_co2eq_kg") %>%
group_by(eu_q_rank) %>%
summarise(value = sum(value)*0.000000001,
eu_ntile_name = first(eu_ntile_name))
co2eq_total = (co2eq %>% summarise(value = sum(value)))$value
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
co2eq_10_10 = round((co2eq %>% filter(eu_q_rank == 10))$value/(co2eq %>% filter(eu_q_rank == 1))$value,digits = 1)
## total per decile
exp_bottom_decile = round((exp %>% filter(eu_q_rank == 1))$value, digits = 1)
exp_top_decile = round((exp %>% filter(eu_q_rank == 10))$value, digits = 1)
energy_bottom_decile = round((energy %>% filter(eu_q_rank == 1))$value, digits = 1)
energy_top_decile = round((energy %>% filter(eu_q_rank == 10))$value, digits = 1)
co2eq_bottom_decile = round((co2eq %>% filter(eu_q_rank == 1))$value, digits = 1)
co2eq_top_decile = round((co2eq %>% filter(eu_q_rank == 10))$value, digits = 1)
## per adult equivalent per decile
aeu = pdat_country_summary_by_eu_ntile %>%
filter(year == 2005,
indicator == "total_adult_eq") %>%
group_by(eu_q_rank) %>%
summarise(value = sum(value),
eu_ntile_name = first(eu_ntile_name))
exp_pae = exp %>%
rename(total_fd_me = value) %>%
left_join(aeu, by = c("eu_q_rank", "eu_ntile_name")) %>%
mutate(pae_fd_e = (total_fd_me/value)*1000000000000)
fd_pae_bottom_decile = round((exp_pae %>% filter(eu_q_rank == 1))$pae_fd_e, digits = 0)
fd_pae_top_decile = round((exp_pae %>% filter(eu_q_rank == 10))$pae_fd_e, digits = 0)
energy_pae = energy %>%
rename(total_energy_use_tj = value) %>%
left_join(aeu, by = c("eu_q_rank", "eu_ntile_name")) %>%
mutate(pae_energy_use_gj = (total_energy_use_tj/value)*1000000000)
energy_pae_bottom_decile = round((energy_pae %>% filter(eu_q_rank == 1))$pae_energy_use_gj, digits = 1)
energy_pae_top_decile = round((energy_pae %>% filter(eu_q_rank == 10))$pae_energy_use_gj, digits = 1)
co2eq_pae = co2eq %>%
rename(total_co2eq_kg = value) %>%
left_join(aeu, by = c("eu_q_rank", "eu_ntile_name")) %>%
mutate(pae_co2eq_t = (total_co2eq_kg/value)*1000000)
co2eq_pae_bottom_decile = round((co2eq_pae %>% filter(eu_q_rank == 1))$pae_co2eq_t, digits = 1)
co2eq_pae_top_decile = round((co2eq_pae %>% filter(eu_q_rank == 10))$pae_co2eq_t, digits = 1)
## intensities
mean_energy_intens = dat_country_summary_by_eu_ntile %>%
filter(year == 2005) %>%
group_by(eu_q_rank) %>%
summarise(pe_energy_use_mj = weighted.mean(pe_energy_use_mj,total_fd_me))
mean_energy_intens_bottom_decile = round((mean_energy_intens %>% filter(eu_q_rank == 1))$pe_energy_use_mj, digits = 1)
mean_energy_intens_top_decile = round((mean_energy_intens %>% filter(eu_q_rank == 10))$pe_energy_use_mj, digits = 1)
mean_co2eq_of_energy_intens = dat_country_summary_by_eu_ntile %>%
filter(year == 2005) %>%
mutate(intensity_e_c = total_co2eq_kg*0.001/total_energy_use_tj) %>%
group_by(eu_q_rank) %>%
summarise(intensity_e_c = weighted.mean(intensity_e_c,total_energy_use_tj))
mean_co2eq_of_energy_intens_bottom_decile = round((mean_co2eq_of_energy_intens %>% filter(eu_q_rank == 1))$intensity_e_c, digits = 1)
mean_co2eq_of_energy_intens_top_decile = round((mean_co2eq_of_energy_intens %>% filter(eu_q_rank == 10))$intensity_e_c, digits = 1)
```
In 2005, total household final demand expenditure was `r exp_total` trn€, the energy footprint `r energy_total` EJ, and the carbon footprint `r co2eq_total` MtCO2eq. We estimated the 10:10 ratios at `r exp_10_10` for expenditure, `r energy_10_10` for the energy footprint, and `r co2eq_10_10` for the carbon footprint. Total expenditure ranged from `r exp_bottom_decile` trn€ to `r exp_top_decile` trn€ (or `r fd_pae_bottom_decile`€ to `r fd_pae_top_decile`€ per adult equivalent) across bottom and top decile, the energy footprint from `r energy_bottom_decile` EJ to `r energy_top_decile` EJ (or `r energy_pae_bottom_decile` GJ/ae to `r energy_pae_top_decile` GJ/ae), and the carbon footprint from `r co2eq_bottom_decile` MtCO2eq to `r co2eq_top_decile` MtCO2eq (or `r co2eq_pae_bottom_decile` tCO2eq/ae to `r co2eq_pae_top_decile` tCO2eq/ae). The average energy intensity of consumption was `r mean_energy_intens_bottom_decile` MJ/€ in the bottom decile and `r mean_energy_intens_top_decile` MJ/€ in the top decile. The carbon intensity of energy was `r mean_co2eq_of_energy_intens_bottom_decile` gCO2eq/TJ in the bottom decile, and `r mean_co2eq_of_energy_intens_top_decile` gCO2eq/TJ in the top decile.
```{r figureS2-test, fig.width=12, fig.height=8, out.width="98%", fig.cap="**Figure S2: Household expenditure and environmental footprints and intensities across European expenditure deciles in 2005. Total expenditures (a), energy footprint (b), and carbon footprint (c) per decile. Energy intensity of consumption as energy footprint per expenditure (d), carbon intensity as carbon footprint per expenditure (e), and carbon intensity of energy as carbon footprint per energy footprint (f).**"}
a = p_top / p_bottom + plot_annotation(tag_levels = 'a') +
plot_layout(guides = 'collect') &
theme(plot.margin = unit(c(0.25,0.25,0.25,0.25), "cm"),
legend.position = 'bottom',
axis.title.y = element_text(size=13, hjust = 0.5),
axis.text.x = element_text(size = 12),
axis.text.y = element_text(size = 12),
legend.text = element_text(size=12),
legend.title = element_text(size=13))
a
ggsave(here("analysis", "figures", "figureS1.pdf"), device=cairo_pdf)
## Year 2010, using main method, EXIOBASE industry-by-industry
p1 = pdat_country_summary_by_eu_ntile %>%
filter(year == 2010,
indicator == "total_fd_me") %>%
group_by(eu_q_rank) %>%
summarise(value = sum(value)*0.000001,
eu_ntile_name = first(eu_ntile_name)) %>%
ggplot(aes(x=eu_ntile_name, y=value)) +
geom_col(position = position_dodge(), fill=pal[1]) +
theme_minimal() +
theme(text=element_text(family="Liberation Sans Narrow")) +
labs(x="", y="Expenditure (trn€)") +
theme(axis.text.x = element_text(angle = 90)) +
scale_x_discrete(labels = c("D01","D02","D03","D04","D05","D06","D07","D08","D09","D10"))
p2 = pdat_country_summary_by_eu_ntile %>%
filter(year == 2010,
indicator == "total_energy_use_tj") %>%
group_by(eu_q_rank) %>%
summarise(value = sum(value)*0.000001,
eu_ntile_name = first(eu_ntile_name)) %>%
ggplot(aes(x=eu_ntile_name, y=value)) +
geom_col(position = position_dodge(), fill=pal[1]) +
theme_minimal() +
theme(text=element_text(family="Liberation Sans Narrow")) +
labs(x="", y="Energy footprint (EJ)") +
theme(axis.text.x = element_text(angle = 90)) +
scale_x_discrete(labels = c("D01","D02","D03","D04","D05","D06","D07","D08","D09","D10"))
p3 = pdat_country_summary_by_eu_ntile %>%
filter(year == 2010,
indicator == "total_co2eq_kg") %>%
group_by(eu_q_rank) %>%
summarise(value = sum(value)*0.000000001,
eu_ntile_name = first(eu_ntile_name)) %>%
ggplot(aes(x=eu_ntile_name, y=value)) +
geom_col(position = position_dodge(), fill=pal[1]) +
theme_minimal() +
theme(text=element_text(family="Liberation Sans Narrow")) +
labs(x="", y="Carbon footprint (MtCO2eq)") +
theme(axis.text.x = element_text(angle = 90)) +
scale_x_discrete(labels = c("D01","D02","D03","D04","D05","D06","D07","D08","D09","D10"))
p1 = dat_country_summary_by_eu_ntile %>%
filter(year == 2010) %>%
ggplot(aes(x=factor(eu_q_rank), y=pe_co2eq_kg)) +
geom_violin(aes(weight=total_fd_me), fill=pal[1], color=pal[1], alpha=0.5) +
geom_point( alpha=0.3) +
geom_segment(data=dat_country_summary_by_eu_ntile %>%
filter(year == 2010) %>%
group_by(eu_q_rank) %>%
summarise(pe_co2eq_kg = weighted.mean(pe_co2eq_kg,total_fd_me)),
aes(y=pe_co2eq_kg, yend=pe_co2eq_kg, x=eu_q_rank-0.3, xend=eu_q_rank+0.3), size=1.5) +
theme_minimal() +
theme(text=element_text(family="Liberation Sans Narrow")) +
labs(x="", y="Carbon intensity per expenditure (kgCO2eq/€)") +
theme(axis.text.x = element_text(angle = 90)) +
scale_x_discrete(labels = c("D01","D02","D03","D04","D05","D06","D07","D08","D09","D10"))
p2 = dat_country_summary_by_eu_ntile %>%
filter(year == 2010) %>%
ggplot(aes(x=factor(eu_q_rank), y=pe_energy_use_mj)) +
geom_violin(aes(weight=total_fd_me), fill=pal[1], color=pal[1], alpha=0.5) +
geom_point( alpha=0.3) +
geom_segment(data=dat_country_summary_by_eu_ntile %>%
filter(year == 2010) %>%
group_by(eu_q_rank) %>%
summarise(pe_energy_use_mj = weighted.mean(pe_energy_use_mj,total_fd_me)),
aes(y=pe_energy_use_mj, yend=pe_energy_use_mj, x=eu_q_rank-0.3, xend=eu_q_rank+0.3), size=1.5) +
theme_minimal() +
theme(text=element_text(family="Liberation Sans Narrow")) +
labs(x="", y="Energy intensity per expenditure (MJ/€)") +
theme(axis.text.x = element_text(angle = 90)) +
scale_x_discrete(labels = c("D01","D02","D03","D04","D05","D06","D07","D08","D09","D10"))
dat3 = dat_country_summary_by_eu_ntile %>%
filter(year == 2010) %>%
mutate(intensity_e_c = total_co2eq_kg*0.001/total_energy_use_tj)
p3 = dat3 %>%
ggplot(aes(x=factor(eu_q_rank), y=intensity_e_c)) +
geom_violin(aes(weight=total_energy_use_tj), fill=pal[1], color=pal[1], alpha=0.5) +
geom_point( alpha=0.3) +
geom_segment(data=dat3 %>%
filter(year == 2010) %>%
group_by(eu_q_rank) %>%
summarise(intensity_e_c = weighted.mean(intensity_e_c,total_energy_use_tj)),
aes(y=intensity_e_c, yend=intensity_e_c, x=eu_q_rank-0.3, xend=eu_q_rank+0.3), size=1.5) +
theme_minimal() +
theme(text=element_text(family="Liberation Sans Narrow")) +
labs(x="", y="Carbon intensity per energy (gCO2eq/TJ)") +
theme(axis.text.x = element_text(angle = 90)) +
scale_x_discrete(labels = c("D01","D02","D03","D04","D05","D06","D07","D08","D09","D10"))
```{r values-in-text-2010-ixi}
# values in text
## inequality
exp = pdat_country_summary_by_eu_ntile %>%
filter(year == 2010,
indicator == "total_fd_me") %>%
group_by(eu_q_rank) %>%
summarise(value = sum(value)*0.000001,
eu_ntile_name = first(eu_ntile_name))
exp_total = (exp %>% summarise(value = sum(value)))$value
exp_10_10 = round((exp %>% filter(eu_q_rank == 10))$value/(exp %>% filter(eu_q_rank == 1))$value,digits = 1)
energy = pdat_country_summary_by_eu_ntile %>%
filter(year == 2010,
indicator == "total_energy_use_tj") %>%
group_by(eu_q_rank) %>%
summarise(value = sum(value)*0.000001,
eu_ntile_name = first(eu_ntile_name))
energy_total = (energy %>% summarise(value = sum(value)))$value
energy_10_10 = round((energy %>% filter(eu_q_rank == 10))$value/(energy %>% filter(eu_q_rank == 1))$value,digits = 1)
co2eq = pdat_country_summary_by_eu_ntile %>%
filter(year == 2010,
indicator == "total_co2eq_kg") %>%
group_by(eu_q_rank) %>%
summarise(value = sum(value)*0.000000001,
eu_ntile_name = first(eu_ntile_name))
co2eq_total = (co2eq %>% summarise(value = sum(value)))$value
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
co2eq_10_10 = round((co2eq %>% filter(eu_q_rank == 10))$value/(co2eq %>% filter(eu_q_rank == 1))$value,digits = 1)
## total per decile
exp_bottom_decile = round((exp %>% filter(eu_q_rank == 1))$value, digits = 1)
exp_top_decile = round((exp %>% filter(eu_q_rank == 10))$value, digits = 1)
energy_bottom_decile = round((energy %>% filter(eu_q_rank == 1))$value, digits = 1)
energy_top_decile = round((energy %>% filter(eu_q_rank == 10))$value, digits = 1)
co2eq_bottom_decile = round((co2eq %>% filter(eu_q_rank == 1))$value, digits = 1)
co2eq_top_decile = round((co2eq %>% filter(eu_q_rank == 10))$value, digits = 1)
## per adult equivalent per decile
aeu = pdat_country_summary_by_eu_ntile %>%
filter(year == 2010,
indicator == "total_adult_eq") %>%
group_by(eu_q_rank) %>%
summarise(value = sum(value),
eu_ntile_name = first(eu_ntile_name))
exp_pae = exp %>%
rename(total_fd_me = value) %>%
left_join(aeu, by = c("eu_q_rank", "eu_ntile_name")) %>%
mutate(pae_fd_e = (total_fd_me/value)*1000000000000)
fd_pae_bottom_decile = round((exp_pae %>% filter(eu_q_rank == 1))$pae_fd_e, digits = 0)
fd_pae_top_decile = round((exp_pae %>% filter(eu_q_rank == 10))$pae_fd_e, digits = 0)
energy_pae = energy %>%
rename(total_energy_use_tj = value) %>%
left_join(aeu, by = c("eu_q_rank", "eu_ntile_name")) %>%
mutate(pae_energy_use_gj = (total_energy_use_tj/value)*1000000000)
energy_pae_bottom_decile = round((energy_pae %>% filter(eu_q_rank == 1))$pae_energy_use_gj, digits = 1)
energy_pae_top_decile = round((energy_pae %>% filter(eu_q_rank == 10))$pae_energy_use_gj, digits = 1)
co2eq_pae = co2eq %>%
rename(total_co2eq_kg = value) %>%
left_join(aeu, by = c("eu_q_rank", "eu_ntile_name")) %>%
mutate(pae_co2eq_t = (total_co2eq_kg/value)*1000000)
co2eq_pae_bottom_decile = round((co2eq_pae %>% filter(eu_q_rank == 1))$pae_co2eq_t, digits = 1)
co2eq_pae_top_decile = round((co2eq_pae %>% filter(eu_q_rank == 10))$pae_co2eq_t, digits = 1)
## intensities
mean_energy_intens = dat_country_summary_by_eu_ntile %>%
filter(year == 2010) %>%
group_by(eu_q_rank) %>%
summarise(pe_energy_use_mj = weighted.mean(pe_energy_use_mj,total_fd_me))
mean_energy_intens_bottom_decile = round((mean_energy_intens %>% filter(eu_q_rank == 1))$pe_energy_use_mj, digits = 1)
mean_energy_intens_top_decile = round((mean_energy_intens %>% filter(eu_q_rank == 10))$pe_energy_use_mj, digits = 1)
mean_co2eq_of_energy_intens = dat_country_summary_by_eu_ntile %>%
filter(year == 2010) %>%
mutate(intensity_e_c = total_co2eq_kg*0.001/total_energy_use_tj) %>%
group_by(eu_q_rank) %>%
summarise(intensity_e_c = weighted.mean(intensity_e_c,total_energy_use_tj))
mean_co2eq_of_energy_intens_bottom_decile = round((mean_co2eq_of_energy_intens %>% filter(eu_q_rank == 1))$intensity_e_c, digits = 1)
mean_co2eq_of_energy_intens_top_decile = round((mean_co2eq_of_energy_intens %>% filter(eu_q_rank == 10))$intensity_e_c, digits = 1)
```
In 2010, total household final demand expenditure was `r exp_total` trn€, the energy footprint `r energy_total` EJ, and the carbon footprint `r co2eq_total` MtCO2eq. We estimated the 10:10 ratios at `r exp_10_10` for expenditure, `r energy_10_10` for the energy footprint, and `r co2eq_10_10` for the carbon footprint. Total expenditure ranged from `r exp_bottom_decile` trn€ to `r exp_top_decile` trn€ (or `r fd_pae_bottom_decile`€ to `r fd_pae_top_decile`€ per adult equivalent) across bottom and top decile, the energy footprint from `r energy_bottom_decile` EJ to `r energy_top_decile` EJ (or `r energy_pae_bottom_decile` GJ/ae to `r energy_pae_top_decile` GJ/ae), and the carbon footprint from `r co2eq_bottom_decile` MtCO2eq to `r co2eq_top_decile` MtCO2eq (or `r co2eq_pae_bottom_decile` tCO2eq/ae to `r co2eq_pae_top_decile` tCO2eq/ae). The average energy intensity of consumption was `r mean_energy_intens_bottom_decile` MJ/€ in the bottom decile and `r mean_energy_intens_top_decile` MJ/€ in the top decile. The carbon intensity of energy was `r mean_co2eq_of_energy_intens_bottom_decile` gCO2eq/TJ in the bottom decile, and `r mean_co2eq_of_energy_intens_top_decile` gCO2eq/TJ in the top decile.
```{r figureS3-test, fig.width=12, fig.height=8, out.width="98%", fig.cap="**Figure S3: Household expenditure and environmental footprints and intensities across European expenditure deciles in 2010. Total expenditures (a), energy footprint (b), and carbon footprint (c) per decile. Energy intensity of consumption as energy footprint per expenditure (d), carbon intensity as carbon footprint per expenditure (e), and carbon intensity of energy as carbon footprint per energy footprint (f).**"}
a = p_top / p_bottom + plot_annotation(tag_levels = 'a') +
plot_layout(guides = 'collect') &
theme(plot.margin = unit(c(0.25,0.25,0.25,0.25), "cm"),
legend.position = 'bottom',
axis.title.y = element_text(size=13, hjust = 0.5),
axis.text.x = element_text(size = 12),
axis.text.y = element_text(size = 12),
legend.text = element_text(size=12),
legend.title = element_text(size=13))
ggsave(here("analysis", "figures", "figureS2.pdf"), device=cairo_pdf)
source(here("analysis", "R", "si", "wrangler_functions_pxp.R"))
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
## load result data for EU deciles
eu_q_count = 10
# summary countries aggregated by country quintiles and eu ntile
dat_country_summary_by_cquint_and_euntile = get_country_summary_by_cquint_and_euntile(eu_q_count)
# pivot to long format for plotting and attach readable indicator names
cols_ex = c("year", "iso2", "quint", "eu_q_rank")
pdat_country_summary_by_cquint_and_euntile =
pivot_results_longer_adorn(dat_country_summary_by_cquint_and_euntile, cols_ex)
# summary of countries by EU quantile without sectoral resolution
dat_country_summary_by_eu_ntile = get_country_summary_by_eu_ntile(eu_q_count)
# pivot to long format for plotting and attach readable indicator names
cols_ex = c("year", "iso2", "eu_q_rank")
pdat_country_summary_by_eu_ntile =
pivot_results_longer_adorn(dat_country_summary_by_eu_ntile, cols_ex)
# summary of countries by country quintile with aggregate sectoral resolution
dat_sector_summary_by_country_quintile = get_sector_summary_by_country_quintile(eu_q_count)
# pivot to long format for plotting and attach readable indicator names
cols_ex = c("year", "iso2", "quint", "eu_q_rank", "sector_agg_id")
pdat_sector_summary_by_country_quintile =
pivot_results_longer_adorn(dat_sector_summary_by_country_quintile, cols_ex)
# summary of eu ntile with aggregate sectoral resolution
dat_sector_summary_by_eu_ntile = get_sector_summary_by_eu_ntile(eu_q_count)
# pivot to long format for plotting and attach readable indicator names
cols_ex = c("year", "eu_q_rank", "sector_agg_id")
pdat_sector_summary_by_eu_ntile =
pivot_results_longer_adorn(dat_sector_summary_by_eu_ntile, cols_ex)
```
p1 = pdat_country_summary_by_eu_ntile %>%
filter(year == 2010,
indicator == "total_fd_me") %>%
group_by(eu_q_rank) %>%
summarise(value = sum(value)*0.000001,
eu_ntile_name = first(eu_ntile_name)) %>%
ggplot(aes(x=eu_ntile_name, y=value)) +
geom_col(position = position_dodge(), fill=pal[1]) +
theme_minimal() +
theme(text=element_text(family="Liberation Sans Narrow")) +
labs(x="", y="Expenditure (trn€)") +
theme(axis.text.x = element_text(angle = 90)) +
scale_x_discrete(labels = c("D01","D02","D03","D04","D05","D06","D07","D08","D09","D10"))
p2 = pdat_country_summary_by_eu_ntile %>%
filter(year == 2010,
indicator == "total_energy_use_tj") %>%
group_by(eu_q_rank) %>%
summarise(value = sum(value)*0.000001,
eu_ntile_name = first(eu_ntile_name)) %>%
ggplot(aes(x=eu_ntile_name, y=value)) +
geom_col(position = position_dodge(), fill=pal[1]) +
theme_minimal() +
theme(text=element_text(family="Liberation Sans Narrow")) +
labs(x="", y="Energy footprint (EJ)") +
theme(axis.text.x = element_text(angle = 90)) +
scale_x_discrete(labels = c("D01","D02","D03","D04","D05","D06","D07","D08","D09","D10"))
p3 = pdat_country_summary_by_eu_ntile %>%
filter(year == 2010,
indicator == "total_co2eq_kg") %>%
group_by(eu_q_rank) %>%
summarise(value = sum(value)*0.000000001,
eu_ntile_name = first(eu_ntile_name)) %>%
ggplot(aes(x=eu_ntile_name, y=value)) +
geom_col(position = position_dodge(), fill=pal[1]) +
theme_minimal() +
theme(text=element_text(family="Liberation Sans Narrow")) +
labs(x="", y="Carbon footprint (MtCO2eq)") +
theme(axis.text.x = element_text(angle = 90)) +
scale_x_discrete(labels = c("D01","D02","D03","D04","D05","D06","D07","D08","D09","D10"))
p1 = dat_country_summary_by_eu_ntile %>%
filter(year == 2010) %>%
ggplot(aes(x=factor(eu_q_rank), y=pe_co2eq_kg)) +
geom_violin(aes(weight=total_fd_me), fill=pal[1], color=pal[1], alpha=0.5) +
geom_point( alpha=0.3) +
geom_segment(data=dat_country_summary_by_eu_ntile %>%
filter(year == 2010) %>%
group_by(eu_q_rank) %>%
summarise(pe_co2eq_kg = weighted.mean(pe_co2eq_kg,total_fd_me)),
aes(y=pe_co2eq_kg, yend=pe_co2eq_kg, x=eu_q_rank-0.3, xend=eu_q_rank+0.3), size=1.5) +
theme_minimal() +
theme(text=element_text(family="Liberation Sans Narrow")) +
labs(x="", y="Carbon intensity per expenditure (kgCO2eq/€)") +
theme(axis.text.x = element_text(angle = 90)) +
scale_x_discrete(labels = c("D01","D02","D03","D04","D05","D06","D07","D08","D09","D10"))
p2 = dat_country_summary_by_eu_ntile %>%
filter(year == 2010) %>%
ggplot(aes(x=factor(eu_q_rank), y=pe_energy_use_mj)) +
geom_violin(aes(weight=total_fd_me), fill=pal[1], color=pal[1], alpha=0.5) +
geom_point( alpha=0.3) +
geom_segment(data=dat_country_summary_by_eu_ntile %>%
filter(year == 2010) %>%
group_by(eu_q_rank) %>%
summarise(pe_energy_use_mj = weighted.mean(pe_energy_use_mj,total_fd_me)),
aes(y=pe_energy_use_mj, yend=pe_energy_use_mj, x=eu_q_rank-0.3, xend=eu_q_rank+0.3), size=1.5) +
theme_minimal() +
theme(text=element_text(family="Liberation Sans Narrow")) +
labs(x="", y="Energy intensity per expenditure (MJ/€)") +
theme(axis.text.x = element_text(angle = 90)) +
scale_x_discrete(labels = c("D01","D02","D03","D04","D05","D06","D07","D08","D09","D10"))
dat3 = dat_country_summary_by_eu_ntile %>%
filter(year == 2010) %>%
mutate(intensity_e_c = total_co2eq_kg*0.001/total_energy_use_tj)
p3 = dat3 %>%
ggplot(aes(x=factor(eu_q_rank), y=intensity_e_c)) +
geom_violin(aes(weight=total_energy_use_tj), fill=pal[1], color=pal[1], alpha=0.5) +
geom_point( alpha=0.3) +
geom_segment(data=dat3 %>%
filter(year == 2010) %>%
group_by(eu_q_rank) %>%
summarise(intensity_e_c = weighted.mean(intensity_e_c,total_energy_use_tj)),
aes(y=intensity_e_c, yend=intensity_e_c, x=eu_q_rank-0.3, xend=eu_q_rank+0.3), size=1.5) +
theme_minimal() +
theme(text=element_text(family="Liberation Sans Narrow")) +
labs(x="", y="Carbon intensity per energy (gCO2eq/TJ)") +
theme(axis.text.x = element_text(angle = 90)) +
scale_x_discrete(labels = c("D01","D02","D03","D04","D05","D06","D07","D08","D09","D10"))
```{r values-in-text-2010-pxp}
# values in text
## inequality
exp = pdat_country_summary_by_eu_ntile %>%
filter(year == 2010,
indicator == "total_fd_me") %>%
group_by(eu_q_rank) %>%
summarise(value = sum(value)*0.000001,
eu_ntile_name = first(eu_ntile_name))
exp_total = (exp %>% summarise(value = sum(value)))$value
exp_10_10 = round((exp %>% filter(eu_q_rank == 10))$value/(exp %>% filter(eu_q_rank == 1))$value,digits = 1)
energy = pdat_country_summary_by_eu_ntile %>%
filter(year == 2010,
indicator == "total_energy_use_tj") %>%
group_by(eu_q_rank) %>%
summarise(value = sum(value)*0.000001,
eu_ntile_name = first(eu_ntile_name))
energy_total = (energy %>% summarise(value = sum(value)))$value
energy_10_10 = round((energy %>% filter(eu_q_rank == 10))$value/(energy %>% filter(eu_q_rank == 1))$value,digits = 1)
co2eq = pdat_country_summary_by_eu_ntile %>%
filter(year == 2010,
indicator == "total_co2eq_kg") %>%
group_by(eu_q_rank) %>%
summarise(value = sum(value)*0.000000001,
eu_ntile_name = first(eu_ntile_name))
co2eq_total = (co2eq %>% summarise(value = sum(value)))$value
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
co2eq_10_10 = round((co2eq %>% filter(eu_q_rank == 10))$value/(co2eq %>% filter(eu_q_rank == 1))$value,digits = 1)
## total per decile
exp_bottom_decile = round((exp %>% filter(eu_q_rank == 1))$value, digits = 1)
exp_top_decile = round((exp %>% filter(eu_q_rank == 10))$value, digits = 1)
energy_bottom_decile = round((energy %>% filter(eu_q_rank == 1))$value, digits = 1)
energy_top_decile = round((energy %>% filter(eu_q_rank == 10))$value, digits = 1)
co2eq_bottom_decile = round((co2eq %>% filter(eu_q_rank == 1))$value, digits = 1)
co2eq_top_decile = round((co2eq %>% filter(eu_q_rank == 10))$value, digits = 1)
## per adult equivalent per decile
aeu = pdat_country_summary_by_eu_ntile %>%
filter(year == 2010,
indicator == "total_adult_eq") %>%
group_by(eu_q_rank) %>%
summarise(value = sum(value),
eu_ntile_name = first(eu_ntile_name))
exp_pae = exp %>%
rename(total_fd_me = value) %>%
left_join(aeu, by = c("eu_q_rank", "eu_ntile_name")) %>%
mutate(pae_fd_e = (total_fd_me/value)*1000000000000)
fd_pae_bottom_decile = round((exp_pae %>% filter(eu_q_rank == 1))$pae_fd_e, digits = 0)
fd_pae_top_decile = round((exp_pae %>% filter(eu_q_rank == 10))$pae_fd_e, digits = 0)
energy_pae = energy %>%
rename(total_energy_use_tj = value) %>%
left_join(aeu, by = c("eu_q_rank", "eu_ntile_name")) %>%
mutate(pae_energy_use_gj = (total_energy_use_tj/value)*1000000000)
energy_pae_bottom_decile = round((energy_pae %>% filter(eu_q_rank == 1))$pae_energy_use_gj, digits = 1)
energy_pae_top_decile = round((energy_pae %>% filter(eu_q_rank == 10))$pae_energy_use_gj, digits = 1)
co2eq_pae = co2eq %>%
rename(total_co2eq_kg = value) %>%
left_join(aeu, by = c("eu_q_rank", "eu_ntile_name")) %>%
mutate(pae_co2eq_t = (total_co2eq_kg/value)*1000000)
co2eq_pae_bottom_decile = round((co2eq_pae %>% filter(eu_q_rank == 1))$pae_co2eq_t, digits = 1)
co2eq_pae_top_decile = round((co2eq_pae %>% filter(eu_q_rank == 10))$pae_co2eq_t, digits = 1)
## intensities
mean_energy_intens = dat_country_summary_by_eu_ntile %>%
filter(year == 2010) %>%
group_by(eu_q_rank) %>%
summarise(pe_energy_use_mj = weighted.mean(pe_energy_use_mj,total_fd_me))
mean_energy_intens_bottom_decile = round((mean_energy_intens %>% filter(eu_q_rank == 1))$pe_energy_use_mj, digits = 1)
mean_energy_intens_top_decile = round((mean_energy_intens %>% filter(eu_q_rank == 10))$pe_energy_use_mj, digits = 1)
mean_co2eq_of_energy_intens = dat_country_summary_by_eu_ntile %>%
filter(year == 2010) %>%
mutate(intensity_e_c = total_co2eq_kg*0.001/total_energy_use_tj) %>%
group_by(eu_q_rank) %>%
summarise(intensity_e_c = weighted.mean(intensity_e_c,total_energy_use_tj))
mean_co2eq_of_energy_intens_bottom_decile = round((mean_co2eq_of_energy_intens %>% filter(eu_q_rank == 1))$intensity_e_c, digits = 1)
mean_co2eq_of_energy_intens_top_decile = round((mean_co2eq_of_energy_intens %>% filter(eu_q_rank == 10))$intensity_e_c, digits = 1)
```
In 2010 but using the product-by-product version of EXIOBASE, total household final demand expenditure was `r exp_total` trn€, the energy footprint `r energy_total` EJ, and the carbon footprint `r co2eq_total` MtCO2eq. We estimated the 10:10 ratios at `r exp_10_10` for expenditure, `r energy_10_10` for the energy footprint, and `r co2eq_10_10` for the carbon footprint. Total expenditure ranged from `r exp_bottom_decile` trn€ to `r exp_top_decile` trn€ (or `r fd_pae_bottom_decile`€ to `r fd_pae_top_decile`€ per adult equivalent) across bottom and top decile, the energy footprint from `r energy_bottom_decile` EJ to `r energy_top_decile` EJ (or `r energy_pae_bottom_decile` GJ/ae to `r energy_pae_top_decile` GJ/ae), and the carbon footprint from `r co2eq_bottom_decile` MtCO2eq to `r co2eq_top_decile` MtCO2eq (or `r co2eq_pae_bottom_decile` tCO2eq/ae to `r co2eq_pae_top_decile` tCO2eq/ae). The average energy intensity of consumption was `r mean_energy_intens_bottom_decile` MJ/€ in the bottom decile and `r mean_energy_intens_top_decile` MJ/€ in the top decile. The carbon intensity of energy was `r mean_co2eq_of_energy_intens_bottom_decile` gCO2eq/TJ in the bottom decile, and `r mean_co2eq_of_energy_intens_top_decile` gCO2eq/TJ in the top decile.
```{r figureS4-test, fig.width=12, fig.height=8, out.width="98%", fig.cap="**Figure S4: Household expenditure and environmental footprints and intensities across European expenditure deciles in 2010 (product-by-product EXIOBASE version). Total expenditures (a), energy footprint (b), and carbon footprint (c) per decile. Energy intensity of consumption as energy footprint per expenditure (d), carbon intensity as carbon footprint per expenditure (e), and carbon intensity of energy as carbon footprint per energy footprint (f).**"}
a = p_top / p_bottom + plot_annotation(tag_levels = 'a') +
plot_layout(guides = 'collect') &
theme(plot.margin = unit(c(0.25,0.25,0.25,0.25), "cm"),
legend.position = 'bottom',
axis.title.y = element_text(size=13, hjust = 0.5),
axis.text.x = element_text(size = 12),
axis.text.y = element_text(size = 12),
legend.text = element_text(size=12),
legend.title = element_text(size=13))
ggsave(here("analysis", "figures", "figureS3.pdf"), device=cairo_pdf)
## Year 2015, using alternative method, EXIOBASE industry-by-industry
There is relatively good agreement between the alternative method footprints and the EXIOBASE footprints, except in Bulgaria, where the alternative method footprint was around 3 times larger. Including Bulgaria, the alternative method footprints were on average 20% larger than the EXIOBASE footprints. With Bulgaria removed they were 10% larger on average. Eastern European countries especially had larger alternative method footprints due to high intensities in electricity production and hot water supply, and then more expenditure in CP045 multiplied by these intensities than the expenditure in EXIOBASE. This is why the figure shows such high footprints in the bottom European deciles compared to the method keeping EXIOBASE footprints the same (ms results).
source(here("analysis", "R", "si", "wrangler_functions_method2_ixi.R"))
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
## load result data for EU deciles
eu_q_count = 10
# summary countries aggregated by country quintiles and eu ntile
dat_country_summary_by_cquint_and_euntile = get_country_summary_by_cquint_and_euntile(eu_q_count)
# pivot to long format for plotting and attach readable indicator names
cols_ex = c("year", "iso2", "quint", "eu_q_rank")
pdat_country_summary_by_cquint_and_euntile =
pivot_results_longer_adorn(dat_country_summary_by_cquint_and_euntile, cols_ex)
# summary of countries by EU quantile without sectoral resolution
dat_country_summary_by_eu_ntile = get_country_summary_by_eu_ntile(eu_q_count)
# pivot to long format for plotting and attach readable indicator names
cols_ex = c("year", "iso2", "eu_q_rank")
pdat_country_summary_by_eu_ntile =
pivot_results_longer_adorn(dat_country_summary_by_eu_ntile, cols_ex)
# summary of countries by country quintile with aggregate sectoral resolution
dat_sector_summary_by_country_quintile = get_sector_summary_by_country_quintile(eu_q_count)
# pivot to long format for plotting and attach readable indicator names
cols_ex = c("year", "iso2", "quint", "eu_q_rank", "coicop")
pdat_sector_summary_by_country_quintile =
pivot_results_longer_adorn(dat_sector_summary_by_country_quintile, cols_ex)
# summary of eu ntile with aggregate sectoral resolution
dat_sector_summary_by_eu_ntile = get_sector_summary_by_eu_ntile(eu_q_count)
# pivot to long format for plotting and attach readable indicator names
cols_ex = c("year", "eu_q_rank", "coicop")
pdat_sector_summary_by_eu_ntile =
pivot_results_longer_adorn(dat_sector_summary_by_eu_ntile, cols_ex)
```
p1 = pdat_country_summary_by_eu_ntile %>%
filter(year == 2015,
indicator == "total_fd_me") %>%
group_by(eu_q_rank) %>%
summarise(value = sum(value)*0.000001,
eu_ntile_name = first(eu_ntile_name)) %>%
ggplot(aes(x=eu_ntile_name, y=value)) +
geom_col(position = position_dodge(), fill=pal[1]) +
theme_minimal() +
theme(text=element_text(family="Liberation Sans Narrow")) +
labs(x="", y="Expenditure (trn€)") +
theme(axis.text.x = element_text(angle = 90)) +
scale_x_discrete(labels = c("D01","D02","D03","D04","D05","D06","D07","D08","D09","D10"))
p2 = pdat_country_summary_by_eu_ntile %>%
filter(year == 2015,
indicator == "total_energy_use_tj") %>%
group_by(eu_q_rank) %>%
summarise(value = sum(value)*0.000001,
eu_ntile_name = first(eu_ntile_name)) %>%
ggplot(aes(x=eu_ntile_name, y=value)) +
geom_col(position = position_dodge(), fill=pal[1]) +
theme_minimal() +
theme(text=element_text(family="Liberation Sans Narrow")) +
labs(x="", y="Energy footprint (EJ)") +
theme(axis.text.x = element_text(angle = 90)) +
scale_x_discrete(labels = c("D01","D02","D03","D04","D05","D06","D07","D08","D09","D10"))
p3 = pdat_country_summary_by_eu_ntile %>%
filter(year == 2015,
indicator == "total_co2eq_kg") %>%
group_by(eu_q_rank) %>%
summarise(value = sum(value)*0.000000001,
eu_ntile_name = first(eu_ntile_name)) %>%
ggplot(aes(x=eu_ntile_name, y=value)) +
geom_col(position = position_dodge(), fill=pal[1]) +
theme_minimal() +
theme(text=element_text(family="Liberation Sans Narrow")) +
labs(x="", y="Carbon footprint (MtCO2eq)") +
theme(axis.text.x = element_text(angle = 90)) +
scale_x_discrete(labels = c("D01","D02","D03","D04","D05","D06","D07","D08","D09","D10"))
p1 = dat_country_summary_by_eu_ntile %>%
filter(year == 2015) %>%
ggplot(aes(x=factor(eu_q_rank), y=pe_co2eq_kg)) +
geom_violin(aes(weight=total_fd_me), fill=pal[1], color=pal[1], alpha=0.5) +
geom_point( alpha=0.3) +
geom_segment(data=dat_country_summary_by_eu_ntile %>%
filter(year == 2015) %>%
group_by(eu_q_rank) %>%
summarise(pe_co2eq_kg = weighted.mean(pe_co2eq_kg,total_fd_me)),
aes(y=pe_co2eq_kg, yend=pe_co2eq_kg, x=eu_q_rank-0.3, xend=eu_q_rank+0.3), size=1.5) +
theme_minimal() +
theme(text=element_text(family="Liberation Sans Narrow")) +
labs(x="", y="Carbon intensity per expenditure (kgCO2eq/€)") +
theme(axis.text.x = element_text(angle = 90)) +
scale_x_discrete(labels = c("D01","D02","D03","D04","D05","D06","D07","D08","D09","D10"))
p2 = dat_country_summary_by_eu_ntile %>%
filter(year == 2015) %>%
ggplot(aes(x=factor(eu_q_rank), y=pe_energy_use_mj)) +
geom_violin(aes(weight=total_fd_me), fill=pal[1], color=pal[1], alpha=0.5) +
geom_point( alpha=0.3) +
geom_segment(data=dat_country_summary_by_eu_ntile %>%
filter(year == 2015) %>%
group_by(eu_q_rank) %>%
summarise(pe_energy_use_mj = weighted.mean(pe_energy_use_mj,total_fd_me)),
aes(y=pe_energy_use_mj, yend=pe_energy_use_mj, x=eu_q_rank-0.3, xend=eu_q_rank+0.3), size=1.5) +
theme_minimal() +
theme(text=element_text(family="Liberation Sans Narrow")) +
labs(x="", y="Energy intensity per expenditure (MJ/€)") +
theme(axis.text.x = element_text(angle = 90)) +
scale_x_discrete(labels = c("D01","D02","D03","D04","D05","D06","D07","D08","D09","D10"))
dat3 = dat_country_summary_by_eu_ntile %>%
filter(year == 2015) %>%
mutate(intensity_e_c = total_co2eq_kg*0.001/total_energy_use_tj)
p3 = dat3 %>%
ggplot(aes(x=factor(eu_q_rank), y=intensity_e_c)) +
geom_violin(aes(weight=total_energy_use_tj), fill=pal[1], color=pal[1], alpha=0.5) +
geom_point( alpha=0.3) +
geom_segment(data=dat3 %>%
filter(year == 2015) %>%
group_by(eu_q_rank) %>%
summarise(intensity_e_c = weighted.mean(intensity_e_c,total_energy_use_tj)),
aes(y=intensity_e_c, yend=intensity_e_c, x=eu_q_rank-0.3, xend=eu_q_rank+0.3), size=1.5) +
theme_minimal() +
theme(text=element_text(family="Liberation Sans Narrow")) +
labs(x="", y="Carbon intensity per energy (gCO2eq/TJ)") +
theme(axis.text.x = element_text(angle = 90)) +
scale_x_discrete(labels = c("D01","D02","D03","D04","D05","D06","D07","D08","D09","D10"))
```{r figureS5-test, fig.width=12, fig.height=8, out.width="98%", fig.cap="**Figure S5: Household expenditure and environmental footprints and intensities across European expenditure deciles in 2015 (EXIOBASE industry-by-industry version, but using alternative method). Total expenditures (a), energy footprint (b), and carbon footprint (c) per decile. Energy intensity of consumption as energy footprint per expenditure (d), carbon intensity as carbon footprint per expenditure (e), and carbon intensity of energy as carbon footprint per energy footprint (f).**"}
a = p_top / p_bottom + plot_annotation(tag_levels = 'a') +
plot_layout(guides = 'collect') &
theme(plot.margin = unit(c(0.25,0.25,0.25,0.25), "cm"),
legend.position = 'bottom',
axis.title.y = element_text(size=13, hjust = 0.5),
axis.text.x = element_text(size = 12),
axis.text.y = element_text(size = 12),
legend.text = element_text(size=12),
legend.title = element_text(size=13))
ggsave(here("analysis", "figures", "figureS4.pdf"), device=cairo_pdf)
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
```{r load-data4, include=FALSE}
# load data wrangling functions
source(here("analysis", "R", "wrangler_functions.R"))
## load result data for EU deciles
eu_q_count = 10
# summary countries aggregated by country quintiles and eu ntile
dat_country_summary_by_cquint_and_euntile = get_country_summary_by_cquint_and_euntile(eu_q_count)
# pivot to long format for plotting and attach readable indicator names
cols_ex = c("year", "iso2", "quint", "eu_q_rank")
pdat_country_summary_by_cquint_and_euntile =
pivot_results_longer_adorn(dat_country_summary_by_cquint_and_euntile, cols_ex)
# summary of countries by EU quantile without sectoral resolution
dat_country_summary_by_eu_ntile = get_country_summary_by_eu_ntile(eu_q_count)
# pivot to long format for plotting and attach readable indicator names
cols_ex = c("year", "iso2", "eu_q_rank")
pdat_country_summary_by_eu_ntile =
pivot_results_longer_adorn(dat_country_summary_by_eu_ntile, cols_ex)
# summary of countries by country quintile with aggregate sectoral resolution
dat_sector_summary_by_country_quintile = get_sector_summary_by_country_quintile(eu_q_count)
# pivot to long format for plotting and attach readable indicator names
cols_ex = c("year", "iso2", "quint", "eu_q_rank", "sector_agg_id")
pdat_sector_summary_by_country_quintile =
pivot_results_longer_adorn(dat_sector_summary_by_country_quintile, cols_ex)
# summary of eu ntile with aggregate sectoral resolution
dat_sector_summary_by_eu_ntile = get_sector_summary_by_eu_ntile(eu_q_count)
# pivot to long format for plotting and attach readable indicator names
cols_ex = c("year", "eu_q_rank", "sector_agg_id")
pdat_sector_summary_by_eu_ntile =
pivot_results_longer_adorn(dat_sector_summary_by_eu_ntile, cols_ex)
```
dat_adult_eq = read_csv(here("analysis", "data", "derived", "si", "adult_eq_per_household.csv")) %>%
filter(year==2015)
dat_tmp = dat_country_summary_by_cquint_and_euntile %>%
filter(year == 2015) %>%
left_join(dat_adult_eq %>%
select(iso2, iso3, quint, adult_e_p_hh), by=c("iso2", "quint"))
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
europe28 = c("AUT",
"BEL",
"BGR",
"CYP",
"CZE",
"DEU",
"DNK",
"EST",
"GRC",
"ESP",
"FIN",
"FRA",
"HRV",
"HUN",
"IRL",
"LTU",
"LVA",
"MLT",
"NLD",
"NOR",
"POL",
"PRT",
"ROU",
"SWE",
"SVN",
"SVK",
"TUR",
"GBR")
population = wbstats::wb(country = europe28,
indicator = "SP.POP.TOTL",
startdate = 1990, enddate = 2017) %>%
select(iso3 = iso3c, population = value, year = date) %>%
mutate(year = parse_number(year))
dat_people_per_adult_eq = dat_tmp %>%
ungroup() %>%
select(year, iso2, iso3, quint, total_adult_eq) %>%
group_by(year, iso2, iso3) %>%
summarise(total_adult_eq = sum(total_adult_eq)) %>%
left_join(population, by = c("year","iso3")) %>%
mutate(pop_per_ae = population/total_adult_eq) %>%
ungroup() %>%
select(iso2, pop_per_ae)
dat_tmp2 = dat_tmp %>%
left_join(dat_people_per_adult_eq, by = "iso2") %>%
mutate(pop_estimate_per_quintile = total_adult_eq*pop_per_ae) %>%
ungroup() %>%
select(iso2,iso3,quint,eu_q_rank,
eu_ntile_name = c("D01","D02","D03","D04","D05","D06","D07","D08","D09","D10")
a_tmp = dat_tmp2 %>%
group_by(eu_q_rank) %>%
summarise(total_population = sum(total_population)) %>%
cbind(eu_ntile_name)