1 Usage

For both R Scripts, simply open the files with RStudio, change the settings if needed and run the functions inside.

R Scripts

  1. gdp_etl_pipeline.R Contains one function which runs the entire ETL pipeline.
  2. gdp_etl_plots.R Contains one function which generates comparison plots for all individual economies and groups of economies. The plots are exported to a pdf file.

Temporal Settings

These settings must be updated both in the R script gdp_etl_pipeline.R and in the documentation file index.Rmd.

  • last_year Last year. Equal to the estimated year if estimation is enabled.
  • enable_estimate_last_year Boolean variable which tells the script if the last year should be estimated using GDP deflators and CPI. Also enables Chapter 8 of this document.

Working Directory

The scripts automatically set the working directory to the location of the active R script file in RStudio.

Directories

Defines paths for:

  • datadir: Data input
  • outputdir: Output files

Economy Metadata

Files found in datadir:

  • Dim_countries.csv: Contains economy codes and valid year ranges.
  • Dim_Countries_Hierarchy_All.csv: Contains hierarchical definitions of groups of economies.
  • lab_all.csv: Contains economy codes and labels.
  • GDP growth rates.xlsx: Contains growth rates for all economies. (needed only when estimating values for the last year)
  • US.GDPTotal_20250718_104458.csv Last release of GDP dataset at UNCTADstat.

Output Files

Files found in outputdir:

  • gdp_update.csv: An updated dataset in a generic format.
  • gdp_update_usis.csv: An updated dataset in a specific format to be used by USIS for uploading to UNCTADstat.
  • gdp_comparison.csv: A dataset containing old and new GDP values.
  • GDP_comparison_groups.pdf: Comparison plots of all individual economies and groups of economies.
  • estimated_with_cpi.csv: Economies for which the real GDP was estimated using CPI.