Logo Lanfrica

iFEED Zambia extremes nutrition analysis code

Domain:

healthcareagricultureclimate

Record type:

software
Creator:
Jennings, StewartRigby, RichardMacKin
Publisher:
Zenodo
Host:avatar

The R code iFEED_TNT.R produces the nutrition security results presented in the associated Zambia analysis. This code produces output files for all climate models and scenarios presented in the paper.

The R code iFEED_land_use_allocation.R produces the food production results associated with each scenario and climate model, as used as input to iFEED_TNT.R (via glam_prod.csv).

This code was developed and tested under the following conditions:

  • Operating System: Linux (x86_64-pc-linux-gnu)
  • System Libraries: GLIBC version 2.17
  • Environment Manager: Conda
  • R Version: 4.5.2

The Conda environment installs the correct version of R (4.5.2) and all required libraries.

 

INSTALLATION, SETUP AND CREATING OUTPUTS

  1. Prerequisites: You must have Miniconda or Anaconda installed. If you do not have it, you can download it at: https://docs.conda.io/en/la…
  2. Create the Environment: The environment is defined in the "environment.yml" file. To create the environment, open your terminal/command prompt, navigate to this project folder, and run:

conda env create -f environment.yml

  1. Activate the Environment: Always activate the environment before running any scripts:

conda activate iFEED_Zambia

  1. Verification: To verify that the environment is set up correctly, run the following command:

Rscript -e "library(writexl); library(codetools); print('Setup Successful')"

5.    Running the scripts:

Rscript iFEED_land_use_allocation.R   

Rscript iFEED_TNT.R

6.    Outputs: The outputs of the paper can be found in the “paper_outputs” directory. After running the scripts, outputs will be saved in the “out” directory to compare.