Skip to contents

Extracts scalar macroeconomic variables from multiple SL4 datasets and aggregates them into a structured data frame.

Usage

gtap_macros_data(
  select_var = NULL,
  experiment = NULL,
  input_path = NULL,
  output_path = NULL,
  output_formats = NULL,
  subtotal_level = FALSE
)

Arguments

select_var

Character vector (optional). List of specific variable names to filter from the final result. If NULL, all variables are returned.

experiment

Character vector. List of experiment names corresponding to SL4 files.

input_path

Character. Path to the directory containing SL4 files.

output_path

Character (optional). Directory to save exported data.

output_formats

Character vector (optional). List of output formats (e.g., "csv", "xlsx").

subtotal_level

Logical. Whether to include subtotal levels in the processed data.

Value

A sorted data frame containing processed GTAP macro data.

Author

Pattawee Puangchit

Examples


# Input Path:
input_path <- system.file("extdata/in", package = "GTAPViz")

# GTAP Macro Variables from 2 .sl4 Files named (EXP1, EXP2)
# Note: No need to add .sl4 to the experiment name
gtap_macro <- gtap_macros_data(NULL, experiment = c("EXP1", "EXP2"),
                               input_path = input_path, subtotal_level = FALSE)