add_mapping_info {GTAPViz} | R Documentation |
Add Mapping Information to GTAP Data
Description
Adds descriptions and unit information to GTAP data based on a specified mapping mode. Supports external mappings or default GTAPv7 mappings, allowing users to enrich datasets with standardized metadata.
Adds description and unit information to GTAP data structures based on a specified mapping mode. This function supports internal GTAPv7 mappings, external mappings, or a combination of both.
Usage
add_mapping_info(
data_list,
external_map = NULL,
mapping = "GTAPv7",
description_info = TRUE,
unit_info = TRUE
)
Arguments
data_list |
A list or nested data structure containing GTAP output data frames. |
external_map |
Optional data frame. External mapping must include columns: |
mapping |
Character. Mapping mode for assigning metadata to variables. Options:
|
description_info |
Logical. If |
unit_info |
Logical. If |
Details
The mapping
argument supports:
Value
The same data structure as input with added "Description"
and "Unit"
columns, if applicable.
Author(s)
Pattawee Puangchit
See Also
Examples
# Load GTAP SL4 data
input_path <- system.file("extdata/in", package = "GTAPViz")
sl4.plot.data <- readRDS(file.path(input_path, "sl4.plot.data.rds"))
# Add mapping using GTAPv7 defaults
gtap_data <- add_mapping_info(sl4.plot.data, mapping = "GTAPv7")
# Use a custom mapping file
my_map <- data.frame(
Variable = c("qgdp", "EV"),
Description = c("Real GDP", "Welfare"),
Unit = c("percent", "million USD")
)
gtap_data <- add_mapping_info(sl4.plot.data, external_map = my_map, mapping = "Mix")