This guide provides installation instructions for the witchplot package and its dependencies.
This is the easiest method and does not require Rtools or compilation.
Steps:
-
Download the shared folder containing:
gdxtools_x.x.x.zipwitchtools_x.x.x.zipwitchplot_x.x.x.zipinstall_witchplot.R
-
Open R or RStudio
-
Set your working directory to the folder containing the files:
setwd("path/to/downloaded/folder") -
Run the installation script:
source("install_witchplot.R") -
Once installation completes, load the package:
library(witchplot) run_witch()
This method installs directly from GitHub but requires Rtools on Windows because some dependencies need compilation.
Prerequisites:
- For Windows users: Install Rtools first
Steps:
-
Download
install_from_github.R -
Open the file and update the
github_repovariable with the correct GitHub repository path -
Run the installation script:
source("install_from_github.R") -
Once installation completes, load the package:
library(witchplot) run_witch()
The witchplot package can visualize two types of data:
-
IIASA Database (e.g., AR6, AR5) - No additional setup needed
run_iiasadb(iamc_databasename = "iamc15")
-
WITCH/RICE GDX files - Requires GAMS installation
run_witch() # Requires GAMS run_rice() # Requires GAMS
If you want to work with WITCH/RICE model GDX files, you need GAMS:
-
Download and install GAMS from: https://www.gams.com/download/
- A free demo license is available
- Note the installation directory (e.g.,
C:/GAMS/47)
-
Initialize the GDX library in R:
library(witchplot) setup_gdx() # Auto-detects GAMS installation # Or specify GAMS path manually if needed: setup_gdx("C:/GAMS/47")
-
Verify it works:
run_witch() # Should now work!
Note: The package will automatically try to initialize GDX when loaded. If you see errors about "GDX library not loaded", follow the steps above.
If you see:
Error: GDX library has not been loaded
Solution:
- Install GAMS from https://www.gams.com/download/
- Run
setup_gdx()in R - See detailed troubleshooting guide at:
TEACHING/TROUBLESHOOTING_GDX.md
Alternative: Use IIASA database viewer (no GAMS needed):
run_iiasadb(iamc_databasename = "iamc15", add_historical = FALSE)- Method 1: Make sure all .zip files are in the same folder as
install_witchplot.R - Method 2: Check your internet connection and that the GitHub repository path is correct
- Use Method 1 (binary packages) instead, or
- Install Rtools from: https://cran.r-project.org/bin/windows/Rtools/
Try restarting R and loading the package again:
# Restart R session, then:
library(witchplot)Close R/RStudio completely and restart, then try installation again.
- witchplot: Interactive visualization toolkit for GAMS IAM model results
- Dependencies from GitHub:
gdxtools(https://github.com/lolow/gdxtools) - Manipulate GDX files in Rwitchtools(https://github.com/witch-team/witchtools) - Data management for IAMs
- CRAN dependencies: Automatically installed (data.table, ggplot2, shiny, etc.)