Skip to contents

Processes GTAP data from SL4 and HAR files with comprehensive support for dynamic analysis, regional aggregation, and deviation calculations across experiments.

Usage

auto_gtap_dynamic(
  experiment,
  project_path = NULL,
  input_path = NULL,
  output_path = NULL,
  sl4_suffix = "",
  har_suffix = "",
  mapping_info = "GTAPv7",
  process_sl4_vars = NULL,
  process_har_vars = NULL,
  sl4_mapping_info = NULL,
  har_mapping_info = NULL,
  sl4_extract_method = "get_data_by_var",
  har_extract_method = "get_data_by_var",
  sl4_priority = NULL,
  har_priority = NULL,
  region_select = NULL,
  sector_select = NULL,
  subtotal_level = FALSE,
  plot_data = FALSE,
  output_formats = NULL,
  process_macro = TRUE,
  sl4_output_name = "sl4.plot.data",
  har_output_name = "har.plot.data",
  macro_output_name = "GTAPMacro",
  mapping_input = NULL,
  agg_mapping = NULL,
  aggregate = FALSE,
  add_world = TRUE,
  cal_deviation = TRUE,
  base_var = "base",
  policy_var = "pol",
  calculation_agg = "+",
  calculation_dev = "-"
)

Arguments

experiment

Character vector. Case names to process.

project_path

Character. Path to the project folder with "in" and "out" subfolders.

input_path

Character. Path to the input folder. Overrides `project_path/in` if specified.

output_path

Character. Path to the output folder. Overrides `project_path/out` if specified.

sl4_suffix

Character. Custom suffix for SL4 files.

har_suffix

Character. Custom suffix for HAR files.

mapping_info

Character. Mapping mode: "GTAPv7" (default), "Yes", "No", or "Mix".

process_sl4_vars

Data frame, NULL, or FALSE. Variables to extract from SL4 files.

process_har_vars

Data frame, NULL, or FALSE. Variables to extract from HAR files.

sl4_mapping_info

Data frame or NULL. Mapping information for SL4 variables.

har_mapping_info

Data frame or NULL. Mapping information for HAR variables.

sl4_extract_method

Character. SL4 extraction method.

har_extract_method

Character. HAR extraction method.

sl4_priority

Optional list. Priority rules for SL4 data grouping.

har_priority

Optional list. Priority rules for HAR data grouping.

region_select

Optional character vector. Specifies regions to filter the data.

sector_select

Optional character vector. Specifies sectors to filter the data.

subtotal_level

Logical. If TRUE, includes subtotal data.

plot_data

Logical. If TRUE, prepares data for plotting and assigns to variables.

output_formats

Character vector or list. Exports data in these formats.

process_macro

Logical. If TRUE, processes macro variables from SL4 files.

sl4_output_name

Character. Variable name for SL4 plotting data.

har_output_name

Character. Variable name for HAR plotting data.

macro_output_name

Character. Variable name for GTAP macro data.

mapping_input

Data frame. Maps experiment IDs to cases and periods.

agg_mapping

List. Mapping for regional or sectoral aggregation.

aggregate

Logical. If TRUE, performs regional/sectoral aggregation.

add_world

Logical. If TRUE, adds "World" totals when aggregating regions.

cal_deviation

Logical. If TRUE, calculates deviations between scenarios.

base_var

Character. Case identifier for baseline scenario.

policy_var

Character. Case identifier for policy scenario.

calculation_agg

Character. Operation for aggregation.

calculation_dev

Character. Operation for deviation calculation.

Value

A list containing the processed datasets with enhanced information for dynamic analysis.

Details

This function extends the base GTAP data processing workflow with additional capabilities for dynamic GE model analysis. It processes SL4 and HAR files, performs regional aggregation, calculates deviations between policy and baseline scenarios, and provides integrated mapping for periods and experiments.

Author

Pattawee Puangchit