This manual is designed for GTAP users.
For a comprehensive guide, please refer to the GTAPViz Vignette
.
This document requires the following R scripts, aligned with the navigation menu:
1.ProjectSetup.R
β 1. Project Setup2.PlotGens.R
β 2. Plotting3.TableGens.R
β 3. TableIf you do not have these R script files (located in the
GTAPViz-user folder), please download the ZIP file:
π GTAPViz-R-GTAPusers-code
# ==== 1. USER SETUP (define the full path e.g., "C:/Users/YourName/Documents") ====
output_dir <- "D:/One Drive/OneDrive - purdue.edu"
# ==== 2. DO NOT CHANGE BELOW THIS LINE ====
if (!dir.exists(output_dir)) dir.create(output_dir, recursive = TRUE)
zip_url <- "https://github.com/Bodysbobb/GTAPViz-R-GTAPuser/raw/main/GTAPViz-user.zip"
zip_file <- tempfile(fileext = ".zip")
download.file(zip_url, zip_file, mode = "wb")
unzip(zip_file, exdir = output_dir)
setwd(output_dir)
message("β
GTAPViz user scripts saved to:\n")
message(paste0("file:///", normalizePath(output_dir, winslash = "/")), "\n")
# Open the folder in Windows Explorer
# src
shell.exec(normalizePath(paste0(output_dir,"/GTAPViz-user/src")))
# map
shell.exec(normalizePath(paste0(output_dir,"/GTAPViz-user/map")))
Copy and paste the following code into your R script, then run it to
install GTAPViz
from CRAN:
# Install the GTAPViz package (note: case-sensitive)
install.packages("GTAPViz")
# Check the installed version of GTAPViz
library(GTAPViz)
packageVersion("GTAPViz")
Comprehensive step-by-step guide from project setup: GTAPViz Vignette
If you donβt have RStudio (or Visual Studio Code with R language support) installed yet, please install either of them first.
RStudio installation: Install R and RStudio
Visual Studio Code installation: Visual Studio Code