This R package automates installation for some of the R packages needed for the functioning of R based data processing and visualization tools developed for the International Model for Policy Analysis of Agricultural Commodities and Trade (IMPACT) model.
The IMPACT model was developed in the early 1990s to explore the long term challenges facing policymakers in reducing hunger and poverty in a sustainable fashion. The IMPACT model has been expanded and improved repeatedly to respond to increasingly complex policy questions and the state-of-the-art of modeling. See documentation of most recent update.
Using the package described here, we will establish the KIRAN suite of R based packages. KIRAN stands for Key IMPACT R-Archive Network akin to Comprehensive R Archive Network (CRAN) which acts as a default repository for many of the R packages.
The goal of this is to to be able to automate the installation process for the three major libraries which make up the KIRAN suite of packages developed by the Foresight and Policy Modeling unit of IFPRI.
-
Base R installation. Please use v4.2.3 or greater (whichever is the latest stable release in case you are installing it for the first time)
-
Rtools installation (on Windows. Not needed on Mac/Linux) - please check for the correct Rtools version based on your base R installation from either step 1 or your existing R installation
-
If you prefer a command prompt interface – please add R executable to your environment variables on Windows based machines.
The KIRAN
package can be easily installed from IFPRI’s R-Universe. To
do so, open a new session of R or R-Studio from your R/R-Studio
installations, and paste the following command on the “Console” of your
R/R-Studio session and press enter.
# Installing from r-universe of IFPRI
install.packages('KIRAN',
repos='http://https://ifpri.r-universe.dev/',
dependencies = TRUE)
Please play close attention to your screen, R/R-Studio might generate some pop-up windows which might not automatically appear on top of yor screen.
Check the task bar on windows machines for any app symbol which might be “blinking”. The same might apply to linux based machines.
Usually, R can do the following once you execute the above command in the form of pop-ups:
-
Ask you to choose a default CRAN repository. Choose 0, or location closest to you.
-
Ask you to restart your R session. Choose Yes if prompted
In case no substantial errors were encountered during the previous step, we can proceed further.
Go back to your R/R-Studio session and type the following and press enter
library(KIRAN)
setKiran()
The command above attempts to install all the packages needed for the correct functioning of the R-based libraries which make up the KIRAN suite of packages.
The workflow of the above command is as follows:
- Installs core R packages which are needed to facilitate the data transfer between GAMS and R
- Installation of
devtools
- Installation of
magclass
for array based operations - Detection of
GAMS
installation - Automatic installation of
gamstransfer
package - Setting up the KIRAN suite of packages (
DOORMAT
,reportIMPACT
,ARIA
)
Once again, please play close attention to your screen, R/R-Studio might generate some pop-up windows which might not automatically appear on top of your screen.
There might even be errors or warnings shown on your R/R-Studio console. Usually these errors or warnings are self-explanatory. In case you are not successful in fixing these errors/warnings, see last section of this document.
In case of questions / problems please contact Abhijeet Mishra (A.Mishra@cgiar.org)