To run mapspam2globiom, you need to install several several R packages and GAMS.

Essential R packages

Several R packages are required to run mapspam2globiom:

  • mapspamc. This packages implements the Spatial Production Allocation Model (SPAM) (You and Wood 2006; You, Wood, and Wood-Sichra 2009; You et al. 2014; Yu et al. 2020) in R (Dijk et al. 2023). The ouput are a set of crop distribution maps that are used as input in the mapspam2globiom package.

  • To interface between R and GAMS the gdxrrw package is required. Unfortunately, this package is not available on CRAN and therefore has to be installed manually. The package can be found here, which also presents instructions on how to install the package. Several functions in mapspamc use gdxrrw to read and save GAMS gdx files and check whether the package and GAMS are installed.

  • tidyverse (Wickham et al. 2019) is the name for a set of packages that work in harmony to facilitate data preparation and processing, most importantly dplyr, purrr, tidyr and ggplot2. Some of them are used by mapspamc and will be installed automatically when the package is installed for the first time and were not installed before.

  • sf package (Pebesma 2018) is a package to process spatial data in vector (polygon) format.

  • terra package (Hijmans 2022) is a package to process spatial data in raster format.

GAMS

mapspam2globiom creates several GAMS gdx files for which GAMS is required. GAMS is a modelling system and language designed for mathematical optimization. The GAMS system and solvers can be downloaded from the GAMS website.

References

Dijk, Michiel van, Ulrike Wood-Sichra, Yating Ru, Zhe Guo, and Liangzhi You. 2023. mapspamc: An R package to create crop distribution maps for country studies using a downscaling approach.” Preprint. https://doi.org/10.21203/rs.3.rs-2497136/v1.
Hijmans, Robert J. 2022. Terra: Spatial data analysis.” https://cran.r-project.org/package=terra.
Pebesma, Edzer. 2018. Simple Features for R: Standardized Support for Spatial Vector Data.” The R Journal 10 (1): 439. https://doi.org/10.32614/RJ-2018-009.
Wickham, Hadley, Mara Averick, Jennifer Bryan, Winston Chang, Lucy McGowan, Romain François, Garrett Grolemund, et al. 2019. Welcome to the Tidyverse.” Journal of Open Source Software 4 (43): 1686. https://doi.org/10.21105/joss.01686.
You, Liangzhi, and Stanley Wood. 2006. An entropy approach to spatial disaggregation of agricultural production.” Agricultural Systems 90 (1): 329–47. https://doi.org/10.1016/j.agsy.2006.01.008.
You, Liangzhi, Stanley Wood, and Ulrike Wood-Sichra. 2009. Generating plausible crop distribution maps for Sub-Saharan Africa using a spatially disaggregated data fusion and optimization approach.” Agricultural Systems 99 (2): 126–40. https://doi.org/10.1016/j.agsy.2008.11.003.
You, Liangzhi, Stanley Wood, Ulrike Wood-Sichra, and Wenbin Wu. 2014. Generating global crop distribution maps: From census to grid.” Agricultural Systems 127: 53–60. https://doi.org/10.1016/j.agsy.2014.01.002.
Yu, Qiangyi, Liangzhi You, Ulrike Wood-Sichra, Yating Ru, Alison K. B. Joglekar, Steffen Fritz, Wei Xiong, Miao Lu, Wenbin Wu, and Peng Yang. 2020. A cultivated planet in 2010 – Part 2: The global gridded agricultural-production maps.” Earth System Science Data 12 (4): 3545–72. https://doi.org/10.5194/essd-12-3545-2020.