# \donttest{
# Load Data:
input_path <- system.file("extdata/in", package = "GTAPViz")
sl4.plot.data <- readRDS(file.path(input_path, "sl4.plot.data.rds"))
data_pivot_table <- sl4.plot.data[["REG"]]
# Generate Pivot Table with Filter
# Only use columns that exist in the data
pivot_table_with_filter(
# === Input & Filter Settings ===
data = data_pivot_table,
filter = c("Variable", "Unit"), # Allow filtering by variable type and unit
# === Pivot Structure ===
rows = c("Region"), # Rows: Regions (removed "Sector" which doesn't exist)
cols = c("Experiment"), # Columns: Experiments
data_fields = "Value", # Values to be aggregated
# === Sheet & Layout ===
raw_sheet_name = "Raw_Data", # Sheet name for raw data
pivot_sheet_name = "Sector_Pivot", # Sheet name for pivot table
dims = "A3", # Starting cell for pivot table
# === Export Options ===
export_table = FALSE,
output_path = NULL,
workbook_name = "Sectoral_Impact_Analysis.xlsx"
)
# }
Run the code above in your browser using DataLab