<!-- README.md is generated from README.Rmd. Please edit that file -->
# capriv
<!-- badges: start -->
<!-- badges: end -->
The goal of capriv is to draw sankey charts, related tables and maps for Common Agricultural Regrionalized Impacts (CAPRI) modelling system, a large-scale economic model with a particular focus on agriculture and food markets. 
- Rtools: RTools is a set of programs that is required on Windows to build R packages from source.
- TIDYKML: tidykml reads selected elements and values from KML files.
- GDXRRW: GDXRRW is an interface between General Algebraic Modeling System (GAMS) and R, it transfers data between GAMS and R and calls gams from within R.
- GAMS environment system: It operations on GAMS data.
- CAPRIR: capriR is a tool for processing, visualizing and analysing both the databases and simulation results of CAPRI.
The packages can be installed with the following commands.
# Rtools is not an R package so you will need to install Rtools first if you don't have it.
# Install Rtools from website: https://cran.r-project.org/bin/windows/Rtools/ (according to your R version)
# check Rtools
install.packages("pkgbuild")
pkgbuild::find_rtools()
# The R devtools package allows packages that are hosted on GitHub to be installed directly from there.
install.packages("devtools")
library(devtools)
# tidykml
devtools::install_github("briatte/tidykml")
library(tidykml)
# Installation gdxrrw from GitHub
devtools::install_github("GAMS-dev/gdxrrw/gdxrrw")
# Or installation from website: <https://support.gams.com/gdxrrw:interfacing_gams_and_r>, then download the required file and point to the specific path of the file.
install.packages("D:/public/yang/CAPRIR_Project/gdxrrw_1.0.5.zip", repos = NULL, type="source")
# Checking if gdxrrw is installed For GAXRRW to work it must be load shared libraries from the GAMS System directory.
library(gdxrrw)
# The igdx command can be used to show what GAMS system directory GDXRRW has found.
igdx()
# if GDX library has not been loaded, tell where is located GAMS.
igdx("D://gams//win64//24.9")
# caprir
# from Thuenen gitlab
devtools::install_git("https://git-dmz.thuenen.de/mindstep/caprir.git", force = TRUE)
# from iiasa gitlab
# devtools::install_git("https://gitlab.iiasa.ac.at/mind-step/caprir.git")
library(caprir)
```
You can install the released version of capriv from [Thünen Gitlab](https://git-dmz.thuenen.de/mindstep/capriv.git) with:
devtools::install_git("https://git-dmz.thuenen.de/mindstep/capriv.git")
# or from iiasa gitlab
# devtools::install_git("https://gitlab.iiasa.ac.at/mind-step/capriv.git")
The necessary packages can be `loaded` with `library()` function as follows:
``` r
library(caprir)
```
## Usage
For more examples, please refer to the [here](inst/examples)
- <https://git-dmz.thuenen.de/capri/capri_reports>
- <https://github.com/trialsolution/caprir>