A brief example of how to run the model, using data for Zambia.
Set up your R script in the Rmd output folder. Take the following two lines of code, and execute them. The vector prod_targ
contains multiplier values for how much production levels for maize and soybean will increase relative to current production levels. Below that, give the values of the weights you want to apply to each of four land use priorities, in the cbeta
vector. The priorities are:
prod_targ <- c("maize" = 4, "soy" = 2) # production target list cbetas <- c("Y" = 0.5, "C" = 0.5, "BD" = 0, "COST" = 0) # Weights vector
The execute the code below, which uses the weights above to find the land that is needed to satisfy the production targets. The output map, displayed here, can be found in the demo.png
file in the Rmd folder.
library(agroEcoTradeoff) # Run model toff <- tradeoff_mod(prod_targ, ybetas = list(1, 1), cbetas = cbetas, currprodmod = 1, input_key = "ZA", ybeta_update = 0, exist_list = NULL, silent = TRUE) convr <- calc(dt_to_raster(toff$conv, CRS(toff$inputs$sp$crs)) * c(1, 2), sum) imp_plot(convr, toff$impacts, fpath = ".", fnm = "demo", ftitle = "50% Yield, 50% Carbon", input_key = "ZA")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.