This file contains all code to estimate the European income-stratified footprints, the European consumption deciles, and generate the figures in both the main manuscript and the supplementary information. It is located in the ‘code’ sub-folder, pulling files from the ‘data’ sub-folder and outputting figures and tables into the ‘figures’ sub-folder. These three sub-folders are self-contained. Keeping ‘params:analyze:’ and ‘params:visualize:’ both set to ‘TRUE’ in the Rmarkdown yaml header above runs the entire code, except for those code chunks set to ‘eval = FALSE’ which all required a high performance cluster computer. In order to generate only the figures from the main manuscript, set ‘params: analyze:’ to ‘FALSE’ in the yaml header above. The data frame from which all main manuscript figures are produced (‘mrio_results_eu_ntile_mapped_n_10’) is saved in the ‘data’ sub-folder as both a .csv and .rds file. It can be read in for generating those figures without running the whole code. Both ‘params:analyze:’ and params:visualize:’ need to be set to TRUE in order to generate the figures in the SI, as they require a few more input files than the main ‘mrio_results_eu_ntile_mapped_n_10’ data frame.
We first load required R packages.
# Libraries:
library(tidyverse)
library(ggpubr)
library(knitr)
library(kableExtra)
library(readxl)
library(latex2exp)
library(stargazer)
library(plm)
library(lmtest)
library(tseries)
library(RColorBrewer)
library(rworldmap)
require(tidyverse)
require(readr)
require(janitor)