To evaluate the soil characteristics of the land units of Marinduque, Philippines, for farming banana, use the suit function as follows:
library(ALUES)
## Loading required package: Rcpp
suit_banana <- suit("banana", terrain=MarinduqueLT)
## Warning in suitability(terrain, crop_soil, mf = mf, sow_month = NULL, minimum
## = minimum, : maximum is set to 16 for factor CECc since all parameter intervals
## are equal.
head(suit_banana[["soil"]]$`Suitability Score`)
##      CFragm   CECc pHH2O SoilTe
## 1 0.8533333 0.7500     0   0.96
## 2 0.8800000 0.7500     0   0.96
## 3 0.8666667 0.7500     0   0.96
## 4 0.8666667 0.7500     0   0.96
## 5 0.8400000 0.7500     0   0.96
## 6 0.8533333 0.8125     0   0.96
head(suit_banana[["soil"]]$`Suitability Class`)
##   CFragm CECc pHH2O SoilTe
## 1     S1   S1     N     S1
## 2     S1   S1     N     S1
## 3     S1   S1     N     S1
## 4     S1   S1     N     S1
## 5     S1   S1     N     S1
## 6     S1   S1     N     S1
To compute the overall suitability of the land units by averaging across factors, use the overall_suit as follows:
osuit <- overall_suit(suit_banana[["soil"]], method="average")
head(osuit)
##       Score Class
## 1 0.6505051    S2
## 2 0.6569697    S2
## 3 0.6537374    S2
## 4 0.6537374    S2
## 5 0.6472727    S2
## 6 0.6656566    S2
The elapsed time for computing the suitability scores and classes were recorded for the land units of Marinduque, which has 881 units (or observations) in total; and, for the region of Lao Cai, Vietnam, which has 2928 land units.
library(microbenchmark)
microbenchmark(
  suppressWarnings(suit("banana", terrain=MarinduqueLT, interval="unbias"))
)
## Unit: milliseconds
##                                                                           expr
##  suppressWarnings(suit("banana", terrain = MarinduqueLT, interval = "unbias"))
##       min       lq     mean   median     uq      max neval
##  6.913794 7.134749 7.899531 7.333799 7.9334 11.81077   100
microbenchmark(
  suppressWarnings(suit("banana", terrain=LaoCaiLT, interval="unbias"))
)
## Unit: milliseconds
##                                                                       expr
##  suppressWarnings(suit("banana", terrain = LaoCaiLT, interval = "unbias"))
##       min       lq     mean   median       uq      max neval
##  10.36607 11.15929 11.85221 11.35369 11.82274 21.01461   100