auto_gtap_data {GTAPViz} | R Documentation |
Process GTAP Data Automation with Flexible Output Options
Description
Processes GTAP data from sl4
and har
files with options for exporting and preparing plot-ready data.
Usage
auto_gtap_data(
experiment,
input_path = NULL,
output_path = NULL,
sl4_suffix = "",
har_suffix = "",
process_sl4_vars = NULL,
process_har_vars = NULL,
mapping_info = "GTAPv7",
sl4_mapping_info = NULL,
har_mapping_info = NULL,
sl4_extract_method = "get_data_by_dims",
har_extract_method = "get_data_by_var",
sl4_priority = NULL,
har_priority = NULL,
sl4_convert_unit = NULL,
har_convert_unit = NULL,
decimals = 4,
rename_columns = TRUE,
region_select = NULL,
sector_select = NULL,
subtotal_level = FALSE,
plot_data = TRUE,
output_formats = NULL,
sl4_output_name = "sl4.plot.data",
har_output_name = "har.plot.data",
macro_output_name = "GTAPMacro",
add_scenario_ranking = FALSE,
rank_column = "ScenarioRank"
)
Arguments
experiment |
Character vector. Case names to process. |
input_path |
Character. Path to the input folder. |
output_path |
Character. Path to the output folder. |
sl4_suffix |
Character. Custom suffix for SL4 files (e.g., |
har_suffix |
Character. Custom suffix for HAR files (e.g., |
process_sl4_vars |
Character,
|
process_har_vars |
Character,
|
mapping_info |
Character. Metadata mode for variable descriptions and units.
Options: |
sl4_mapping_info |
Data frame or |
har_mapping_info |
Data frame or |
sl4_extract_method |
Character. SL4 extraction method: |
har_extract_method |
Character. HAR extraction method. Same options as above. |
sl4_priority |
Optional list. Required only when |
har_priority |
Optional list. Required only when |
sl4_convert_unit |
Character or |
har_convert_unit |
Character or |
decimals |
Integer or |
rename_columns |
Logical. If |
region_select |
Optional character vector. Filters data to selected regions.
Applies only to the |
sector_select |
Optional character vector. Filters data to selected sectors.
Applies only to the |
subtotal_level |
Logical. If |
plot_data |
Logical. If |
output_formats |
Character vector or list. Output formats for export. Valid values: |
sl4_output_name |
Character. Variable name to assign SL4 output. Default: |
har_output_name |
Character. Variable name to assign HAR output. Default: |
macro_output_name |
Character. Variable name to assign macro output. Default: |
add_scenario_ranking |
Logical or
|
rank_column |
Character. Name of the ranking column. Default is |
Details
To prepare data for plotting and generating tables within the GTAPViz package, the
"Unit"
column must be included in the output.When using the extraction method
"group_data_by_dims"
, the corresponding priority list must be defined via thesl4_priority
orhar_priority
argument. Seegroup_data_by_dims
for more details.
Value
A processed GTAP-formatted dataset with standardized structure and metadata, ready for analysis or visualization.
Author(s)
Pattawee Puangchit
See Also
add_mapping_info
, convert_units
,
rename_value
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_data <- auto_gtap_data(experiment = c("EXP1", "EXP2"),
har_suffix = "-WEL",
input_path = input_path, subtotal_level = FALSE,
process_sl4_vars = NULL, process_har_vars = NULL,
mapping_info = "GTAPv7", plot_data = TRUE)