This repository contains the code required to reproduce the analysis and figures for a national scenario analysis. The workflow is implemented in R and organized around a single project structure with a central execution script.
The data directory contains reference datasets, including IPCC AR6 data, effort-sharing data, historical CO₂ emissions (IEA-EDGAR), and World Bank income classifications.
IPCC AR6 scenario data v1.1 are downloaded from https://data.ene.iiasa.ac.at/ar6 (AR6 Scenarios Database hosted by IIASA, release v1.1). Place the following files inside the data/ref_data/ folder from AR6 database:
AR6_Scenarios_Database_World_v1.1.csv
AR6_Scenarios_Database_R5_regions_v1.1.csv
AR6_Scenarios_Database_metadata_indicators_v1.1.xlsx
Historical CO2 emissions database (IEA-EDGAR CO2) is downloaded from https://edgar.jrc.ec.europa.eu/dataset_ghg80. Place the following file inside the data/ref_data/ folder:
IEA_EDGAR_CO2_1970_2022.xlsx
Economic classification of countries is based on the World Bank's classification which is downloaded from https://datahelpdesk.worldbank.org/knowledgebase/articles/906519-world-bank-country-and-lending-groups
Effort sharing allocations of global carbon budget is based on the calculation method used by (Fujimori, S. et al, 2026), DOI: https://doi.org/10.1038/s43247-026-03208-5
Scenario data used in the analysis is available from the authors upon request. After obtaining the scenario data file, please place it inside data/scen_data/ folder without changing the file name.
All figures and results can be generated by running the main script after setting up the project environment. R version 4.3.1 was used to perform statistical analysis.
To reproduce the analysis:
- Clone or download this repository
- Open the
.Rprojfile in RStudio - Install the required packages (see below)
- Download the required reference datasets and place them inside
data/ref_datafolder - Place national scenario database inside
data/scen_datafolder - Run the main script:
source("prog/main.R")All outputs (figures) will be saved automatically in:
output/figures/
The project uses a structured directory layout managed via the here package for reproducible file paths:
├── prog/
│ ├── main.R # Entry point for running the full workflow and main figures
│ ├── sup_plots.R # Supplementary figures
│ ├── config.R # Path configuration and global settings
│ ├── region_mapping.R # Region and country mapping definitions
│ ├── load_data.R # Data loading functions
│ ├── process_data.R # Data cleaning and preprocessing steps
│ ├── unit_correction_table.R # Unit harmonization and correction logic
│ └── functions.R # Custom helper and plotting functions
│
├── data/
│ ├── ref_data/ # Reference datasets
│ └── scen_data/ # Scenario data inputs and processed files
│
└── output/
└── figures/
├── main/ # Main manuscript figures
└── supplementary/ # Supplementary figures
The analysis relies on the following R packages:
tidyverse
readr
readxl
ggpubr
patchwork
RColorBrewer
sf
rnaturalearth
broom
here
Install all dependencies with:
install.packages(c(
"tidyverse", "readr", "ggpubr", "readxl", "RColorBrewer",
"broom", "patchwork", "sf", "rnaturalearth", "here"
))