This function calculates the suitability scores and class of the land units.

suit(
  crop,
  terrain = NULL,
  water = NULL,
  temp = NULL,
  mf = "triangular",
  sow_month = NULL,
  minimum = NULL,
  maximum = "average",
  interval = NULL,
  sigma = NULL
)

Arguments

crop

a string for the name of the crop;

terrain

a data frame for the terrain characteristics of the input land units;

water

a data frame for the water characteristics of the input land units;

temp

a data frame for the temperature characteristics of the input land units;

mf

membership function with default assigned to "triangular" fuzzy model. Other fuzzy models included are "trapezoidal" and "gaussian".

sow_month

sowing month of the crop. Takes integers from 1 to 12 (inclusive), representing the twelve months of the year. So if sets to 1, the function assumes sowing month to be January.

minimum

factor's minimum value. If NULL (default), minimum is set to 0. But if numeric of length one, say 0.5, then minimum is set to 0.5, for all factors. To set multiple minimums for multiple factors, simply concatenate these into a numeric vector, the length of this vector should be equal to the number of factors in input land units parameters. However, it can also be set to "average", please refer to the online documentation for more, link in the "See Also" section below.

maximum

maximum value for factors. To set multiple maximums for multiple factors, simply concatenate these into a numeric vector, the length of this vector should be equal to the number of factors in input land units parameters. However, it can also be set to "average", please refer to the online documentation for more, link in the "See Also" section below.

interval

domains for every suitability class (S1, S2, S3). If fixed (NULL), the interval would be 0 to 25% for N (Not Suitable), 25% to 50% for S3 (Marginally Suitable), 50% to 75% for S2 (Moderately Suitable), and 75% to 100% for (Highly Suitable). If "unbias", the package will take into account the shape of the membership function, and provide the appropriate suitability class intervals. However, it can also be customized by specifying the limits of the suitability classes. Please refer to the online documentation for more, link in the "See Also" section below.

sigma

If mf = "gaussian", then sigma represents the constant sigma in the Gaussian formula.

Value

A list of outputs of target characteristics, with the following components:

  • "terrain" - a list of outputs for terrain characteristics

  • "soil" - a list of outputs for soil characteristics

  • "water" - a list of outputs for water characteristics

  • "temp" - a list of outputs for temperature characteristics

These components are only available when specified as the target characteristics in either of the arguments above, that is, if terrain argument is specified above, then the "terrain"and "soil" components will be available in the output list. This is also true if water and tempare specified in the arguments above. Each of the components returned above contains a list of outputs as well with the following components:

  • "Factors Evaluated" - a character of factors that matched between the input land units factor and the targetted crop requirement factor

  • "Suitability Score" - a data frame of suitability scores for each of the matched factors

  • "Suitability Class" - a data frame of suitability classes for each of the matched factors

  • "Factors' Minimum Values" - a numeric of minimum values used in the membership function for computing the suitability scores

  • "Factors' Minimum Values" - a numeric of maximum values used in the membership function for computing the suitability scores

  • "Factors' Weights" - a numeric of weights of the factors specified in the input crop requirements

  • "Crop Evaluated" - a character of the name of the targetted crop requirement dataset

See also

https://alstat.github.io/ALUES/; overall_suit

Examples

library(ALUES)
banana_suit <- suit("banana", terrain=MarinduqueLT)
#> Warning: maximum is set to 16 for factor CECc since all parameter intervals are equal.
names(banana_suit)
#> [1] "terrain" "soil"   

# The warning above simply tells the user that one of the factor, 
# CECc, in the target crop requirement, has parameter intervals for 
# all suitability classes equal to 16, and the package used this value 
# as the maximum constant for computing the suitability scores. For more,
# please refer to the **Article 2: Methodology used in ALUES** of the documentation.
# The `suit` function returns a list of output of target 
# characteristics, in this case `"terrain"` and `"soil"`. To access 
# the output, simply run the following:

# lapply is used to display the head of each items in the list
lapply(banana_suit[["terrain"]], function(x) head(x)) 
#> [[1]]
#> [1] "Error: No factor(s) to be evaluated, since none matches with the crop requirements. If water or temp characteristics was specified then maybe you forgot to specify the sow_month argument, read doc for suit."
#> 
lapply(banana_suit[["soil"]], function(x) head(x))
#> $`Factors Evaluated`
#> [1] "CFragm" "CECc"   "pHH2O"  "SoilTe"
#> 
#> $`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
#> 
#> $`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
#> 
#> $`Factors' Minimum Values`
#> CFragm   CECc  pHH2O SoilTe 
#>      0      0      0      0 
#> 
#> $`Factors' Maximum Values`
#> CFragm   CECc  pHH2O SoilTe 
#>  75.00  16.00   8.94  12.50 
#> 
#> $`Factors' Weights`
#> [1] 3 3 3 2
#> 
#> $`Crop Evaluated`
#> [1] "BANANASoil"
#> 
#> $Warning
#> [1] "maximum is set to 16 for factor CECc since all parameter intervals are equal."
#> 

# Each of these are lists, with the following names:
names(banana_suit[["soil"]])
#> [1] "Factors Evaluated"       "Suitability Score"      
#> [3] "Suitability Class"       "Factors' Minimum Values"
#> [5] "Factors' Maximum Values" "Factors' Weights"       
#> [7] "Crop Evaluated"          "Warning"                

# So that, to access the factors evaluated, simply run the following:
banana_suit[["soil"]][["Factors Evaluated"]]
#> [1] "CFragm" "CECc"   "pHH2O"  "SoilTe"

## Targetting Crop
# There are 56 crops available in ALUES, and what we've illustrated 
# above is for banana only. Other crops are listed below:
d <- utils::data(package = "ALUES")
alues_data <- d$results[, "Item"]
crop_data <- regmatches(alues_data, gregexpr(paste0("^[A-Z]{2,}", 
collapse = "|"), alues_data))
crop_data <- unique(unlist(lapply(crop_data, 
function(x) substr(x, 1, nchar(x)-1))))
crop_data
#>  [1] "ALFALFA"    "AVOCADO"    "BAMBOO"     "BANANA"     "BARLEY"    
#>  [6] "BEANCA"     "BEANS"      "CABBAGE"    "CARROTS"    "CASHEW"    
#> [11] "CASSAVA"    "CHICKPEA"   "CINNAMON"   "CITRUS"     "COCOA"     
#> [16] "COCONUT"    "COFFEEAR"   "COFFEERO"   "COTTON"     "COWPEA"    
#> [21] "CUCUMBER"   "GROUNDNUTS" "GUAVA"      "LONGAN"     "MAIZE"     
#> [26] "MANGO"      "MILLETS"    "OILPALM"    "OLIVES"     "ONION"     
#> [31] "PAPAYA"     "PEACH"      "PEAR"       "PEA"        "PEPPERGR"  
#> [36] "PERSIMMON"  "PINEAPPLE"  "PLUM"       "POTATOSW"   "POTATO"    
#> [41] "RICEBR"     "RICEIW"     "RICENF"     "RICEUR"     "RUBBER"    
#> [46] "SAFFLOWER"  "SESAME"     "SORGHUM"    "SOYA"       "SUGARCANE" 
#> [51] "SUNFLOWER"  "TEA"        "TOBACCO"    "TOMATO"     "WATERMELON"
#> [56] "WHEAT"     

# These are the names for the input string for the 
# `suit` function. For example, to target sweet potato the 
# input string is not `"sweet potato"` but rather `potatosw`. That is,
# potato_suit1 <- suit("sweet potato", terrain=MarinduqueLT)
potato_suit2 <- suit("potatosw", terrain=MarinduqueLT)
#> Warning: maximum is set to 16 for factor CECc since all parameter intervals are equal.

## Targetting Crop Factors
# The idea of evaluating a land unit is to match the 
# quality of the land against the standard value of the 
# target factor. Therefore, if the crop does not include 
# the factor you are targeting, then there won't be any 
# matching to be done. For example, the land units evaluated 
# above are those in Marindque, which has the following soil 
# and terrain characteristics:
head(MarinduqueLT)
#>        Lat      Lon CECc pHH2O CFragm SoilTe
#> 1 121.8792 13.52084   12    53     11     12
#> 2 121.8875 13.52084   12    52      9     12
#> 3 121.8958 13.52084   12    53     10     12
#> 4 121.9375 13.52084   12    52     10     12
#> 5 121.9458 13.52084   12    54     12     12
#> 6 121.9542 13.52084   13    54     11     12
# The crop that we are trying to target is banana. The `suit`
# function simply require the user to input a string name for 
# the target crop, and the function will look for the corresponding 
# crop datasets. For example, for banana these are the crop 
# requirements datasets for the four characteristics:
BANANATerrain
#>       code s3_a s2_a s1_a s1_b s2_b s3_b  wts
#> 1   Slope1  6.0    4    2 <NA> <NA> <NA> <NA>
#> 2   Slope2 16.0    8    4 <NA> <NA> <NA> <NA>
#> 3   Slope3 30.0   16    8 <NA> <NA> <NA> <NA>
#> 4    Flood  2.5    2    1 <NA> <NA> <NA>    1
#> 5 Drainage  4.0    3    2 <NA> <NA> <NA>    2
#> 6   SlopeD  3.0    2    1 <NA> <NA> <NA>    1
BANANASoil
#>       code s3_a s2_a  s1_a s1_b s2_b s3_b wts
#> 1   CFragm 55.0 35.0  15.0 <NA> <NA> <NA>   3
#> 2  SoilDpt 50.0 75.0 100.0 <NA> <NA> <NA>   2
#> 3    CaCO3 15.0 10.0   0.0 <NA> <NA> <NA>   3
#> 4     Gyps 10.0  4.0   0.0 <NA> <NA> <NA>   3
#> 5     CECc 16.0 16.0  16.0 <NA> <NA> <NA>   3
#> 6       BS 19.9 20.0  35.0 <NA> <NA> <NA>   3
#> 7   SumBCs  2.8  2.8   4.0 <NA> <NA> <NA>   3
#> 8    pHH2O  4.5  5.2   5.6  7.5    8  8.2   3
#> 9       OC  0.7  0.8   1.5 <NA> <NA> <NA>   2
#> 10   ECedS  6.0  4.0   2.0 <NA> <NA> <NA>   3
#> 11     ESP 12.0  8.0   4.0 <NA> <NA> <NA>   3
#> 12  SoilTe  2.0  4.0   9.0 <NA> <NA> <NA>   2
BANANAWater
#>       code s3_a s2_a s1_a s1_b s2_b s3_b  wts
#> 1     WyAv 1000 1250 1500 <NA> <NA> <NA> <NA>
#> 2 WmDryLen    6    4    3 <NA> <NA> <NA> <NA>
BANANATemp
#>        code s3_a s2_a s1_a s1_b s2_b s3_b  wts
#> 1   TyMaxAv   14   16   18 <NA> <NA> <NA>    2
#> 2   TmMinXm    2    8   15 <NA> <NA> <NA>    2
#> 3 TmMinXmAb   -2    0    8 <NA> <NA> <NA> <NA>
# These datasets are used by the `suit` function depending 
# on the targetted characteristics of the input land units 
# (specified by the user) on the said function. So for 
# `banana_suit` object above, the target crop datasets were 
# `BANANATerrain` and `BANANASoil` since the input land unit 
# specified is `terrain=MarinduqueLT`. Further, the input land 
# unit only targetted the soil factors and not the terrain factors, 
# since none of the factors in `MarinduqueLT` matched with the 
# factors in `BANANATerrain`. That is why, accessing the output 
# for the terrain characteristics for the `banana_suit` object 
# will return the following:
banana_suit[["terrain"]]
#> [1] "Error: No factor(s) to be evaluated, since none matches with the crop requirements. If water or temp characteristics was specified then maybe you forgot to specify the sow_month argument, read doc for suit."

## Targetting Multiple Characteristics
# The example above only targetted the terrain and soil 
# characteristics, but the `suit` function allows user to 
# also target water and temp simultaneously. For examples, 
# we can evaluate the land units of Lao Cai, Vietnam for all 
# three characteristics as follows for irrigated rice (`riceiw``):
riceiw_multi <- suit("riceiw", terrain=LaoCaiLT, water=LaoCaiWater, 
temp=LaoCaiTemp, sow_month=10)
names(riceiw_multi)
#> [1] "terrain" "soil"    "water"   "temp"   

# It is necessary to specify the sowing month when specifying 
# the water and temperature characteristics of the input land 
# units. In this case, we are saying that the first sowing 
# month for both water and temperature characteristics 
# correspond to October (*See* Article 6 for more on this). 
# No factors were targetted by input land unit for banana for
# terrain, water and temperature characteristics.
lapply(riceiw_multi[["terrain"]], function(x) head(x))
#> $`Factors Evaluated`
#> [1] "Flood"  "SlopeD"
#> 
#> $`Suitability Score`
#>   Flood SlopeD
#> 1  0.75   0.75
#> 2  0.75   0.75
#> 3  0.75   0.75
#> 4  0.75   0.75
#> 5  0.75   0.75
#> 6  0.50   0.75
#> 
#> $`Suitability Class`
#>   Flood SlopeD
#> 1    S1     S1
#> 2    S1     S1
#> 3    S1     S1
#> 4    S1     S1
#> 5    S1     S1
#> 6    S2     S1
#> 
#> $`Factors' Minimum Values`
#>  Flood SlopeD 
#>      0      0 
#> 
#> $`Factors' Maximum Values`
#>  Flood SlopeD 
#>      4      4 
#> 
#> $`Factors' Weights`
#> [1] 1 1
#> 
#> $`Crop Evaluated`
#> [1] "RICEIWTerrain"
#> 
lapply(riceiw_multi[["soil"]], function(x) head(x))
#> $`Factors Evaluated`
#> [1] "CFragm"  "SoilDpt" "CECc"    "BS"      "SumBCs"  "OC"     
#> 
#> $`Suitability Score`
#>      CFragm   SoilDpt      CECc        BS    SumBCs        OC     pHH2O SoilTe
#> 1 1.0000000 0.4390244 0.9789474 0.7692308 0.6346154 0.7368421 0.7883212   0.75
#> 2 1.0000000 0.4390244 0.9789474 0.7692308 0.6346154 0.7368421 0.7883212   0.75
#> 3 1.0000000 0.4390244 0.9789474 0.7692308 0.6346154 0.7368421 0.7883212   0.75
#> 4 1.0000000 0.4390244 0.9789474 0.7692308 0.6346154 0.7368421 0.7883212   0.75
#> 5 1.0000000 0.4390244 0.9789474 0.7692308 0.6346154 0.7368421 0.7883212   0.75
#> 6 0.9019608 0.6341463 0.0000000 0.5341538 0.6019231 0.6368421 0.7737226   0.25
#> 
#> $`Suitability Class`
#>   CFragm SoilDpt CECc BS SumBCs OC pHH2O SoilTe
#> 1     S1      S3   S1 S1     S2 S2    S1     S1
#> 2     S1      S3   S1 S1     S2 S2    S1     S1
#> 3     S1      S3   S1 S1     S2 S2    S1     S1
#> 4     S1      S3   S1 S1     S2 S2    S1     S1
#> 5     S1      S3   S1 S1     S2 S2    S1     S1
#> 6     S1      S2    N S2     S2 S2    S1     S3
#> 
#> $`Factors' Minimum Values`
#>  CFragm SoilDpt    CECc      BS  SumBCs      OC 
#>       0       0       0       0       0       0 
#> 
#> $`Factors' Maximum Values`
#>  CFragm SoilDpt    CECc      BS  SumBCs      OC 
#>    51.0   102.5    19.0    65.0     5.2     1.9 
#> 
#> $`Factors' Weights`
#> [1] 3 3 3 2 3 2
#> 
#> $`Crop Evaluated`
#> [1] "RICEIWSoil"
#> 
lapply(riceiw_multi[["water"]], function(x) head(x))
#> $`Factors Evaluated`
#> [1] "Oct" "Nov" "Dec" "Jan"
#> 
#> $`Suitability Score`
#>         Oct       Nov        Dec       Jan
#> 1 0.3665481 0.1949630 0.06068148 0.1170857
#> 2 0.4050074 0.2246519 0.09386667 0.2040571
#> 3 0.3820444 0.2175704 0.08654815 0.1921714
#> 4 0.2256000 0.2367111 0.03573333 0.1185143
#> 5 0.2422222 0.2302519 0.04157037 0.1266857
#> 6 0.3205333 0.2062222 0.07051852 0.1724000
#> 
#> $`Suitability Class`
#>   Oct Nov Dec Jan
#> 1  S3   N   N   N
#> 2  S3   N   N   N
#> 3  S3   N   N   N
#> 4   N   N   N   N
#> 5   N   N   N   N
#> 6  S3   N   N   N
#> 
#> $`Factors' Minimum Values`
#> Oct Nov Dec Jan 
#>   0   0   0   0 
#> 
#> $`Factors' Maximum Values`
#>   Oct   Nov   Dec   Jan 
#> 880.0 880.0 880.0 714.2 
#> 
#> $`Factors' Weights`
#> [1] NA NA NA NA
#> 
#> $`Crop Evaluated`
#> [1] "RICEIWWater"
#> 
lapply(riceiw_multi[["temp"]], function(x) head(x))
#> $`Factors Evaluated`
#> [1] "Nov"
#> 
#> $`Suitability Score`
#>         Nov
#> 1 0.5283333
#> 2 0.5330000
#> 3 0.5410000
#> 4 0.6453333
#> 5 0.6306667
#> 6 0.5653333
#> 
#> $`Suitability Class`
#>   Nov
#> 1  S2
#> 2  S2
#> 3  S2
#> 4  S2
#> 5  S2
#> 6  S2
#> 
#> $`Factors' Minimum Values`
#> Nov 
#>   0 
#> 
#> $`Factors' Maximum Values`
#> Nov 
#>  52 
#> 
#> $`Factors' Weights`
#> [1] 2
#> 
#> $`Crop Evaluated`
#> [1] "RICEIWTemp"
#> 

# Only the head (first six) of the output of the items are shown.

## Membership Function
# There are three membership functions (MFs) available in 
# the `suit` function, namely *triangular*, *trapezoidal* 
# and *Gaussian*. For example, the following computes the 
# suitability scores and classes using trapezoidal MF.
banana_suit <- suit("banana", terrain=MarinduqueLT, mf="trapezoidal")
#> Warning: maximum is set to 16 for factor CECc since all parameter intervals are equal.
head(banana_suit[["soil"]][["Suitability Score"]])
#>   CFragm   CECc pHH2O SoilTe
#> 1      1 0.7500     0      1
#> 2      1 0.7500     0      1
#> 3      1 0.7500     0      1
#> 4      1 0.7500     0      1
#> 5      1 0.7500     0      1
#> 6      1 0.8125     0      1
head(banana_suit[["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

## Intervals
# Another option available in the `suit` function is the 
# `interval`. By default, ALUES uses an equally spaced 
# suitability class intervals for deriving the suitability 
# class. That is, for N [0, 0.25), S3 [0.25, 0.50), 
# S2 [0.50, 0.75), and S1 [0.75, 1].

### Custom Intervals
# Users can modify the default equally spaced intervals, for example:
banana_suit <- suit("banana", terrain=MarinduqueLT, 
mf="trapezoidal", interval=c(0, 0.3, 0.6, 0.9, 1))
#> Warning: maximum is set to 16 for factor CECc since all parameter intervals are equal.
head(banana_suit[["soil"]][["Suitability Score"]])
#>   CFragm   CECc pHH2O SoilTe
#> 1      1 0.7500     0      1
#> 2      1 0.7500     0      1
#> 3      1 0.7500     0      1
#> 4      1 0.7500     0      1
#> 5      1 0.7500     0      1
#> 6      1 0.8125     0      1
head(banana_suit[["soil"]][["Suitability Class"]])
#>   CFragm CECc pHH2O SoilTe
#> 1     S1   S2     N     S1
#> 2     S1   S2     N     S1
#> 3     S1   S2     N     S1
#> 4     S1   S2     N     S1
#> 5     S1   S2     N     S1
#> 6     S1   S2     N     S1
# The above code sets the new suitability class intervals 
# into: N [0, 0.3), S3 [0.3, 0.6), S2 [0.6, 0.9), and S1 [0.9, 1].

### Unbias Intervals
# The problem with the fixed interval is that the said 
# intervals does not take into account the shape of the 
# membership function and the spacing of the parameter 
# interval limits (*See* Article 2 for parameter intervals). 
# Custom intervals might be able to capture this if the user 
# computed the interval limits manually, but ALUES provides 
# an option just for this, by setting `interval="unbias"`. 
# That is,
banana_suit <- suit("banana", terrain=MarinduqueLT, 
mf="trapezoidal", interval="unbias")
#> Warning: maximum is set to 16 for factor CECc since all parameter intervals are equal.
head(banana_suit[["soil"]][["Suitability Score"]])
#>   CFragm   CECc pHH2O SoilTe
#> 1      1 0.7500     0      1
#> 2      1 0.7500     0      1
#> 3      1 0.7500     0      1
#> 4      1 0.7500     0      1
#> 5      1 0.7500     0      1
#> 6      1 0.8125     0      1
head(banana_suit[["soil"]][["Suitability Class"]])
#>   CFragm CECc pHH2O SoilTe
#> 1     S1    N     N     S1
#> 2     S1    N     N     S1
#> 3     S1    N     N     S1
#> 4     S1    N     N     S1
#> 5     S1    N     N     S1
#> 6     S1    N     N     S1
# By setting the `interval="unbias"`, the `suit` 
# function will generate a different likely unequally 
# spaced suitability class intervals, but the interval 
# limits are mathematically correct, in terms of the mapping
# of the parameter interval limits to suitability class limits 
# via the membership function.

## Maximum and Minimum
# Another parameter that can be set for `suit` are the 
# `minimum` and `maximum`. These are the constants used 
# by the membership function for computing the suitability 
# score.
banana_suit <- suit("banana", terrain=MarinduqueLT, 
mf="trapezoidal", interval="unbias")
#> Warning: maximum is set to 16 for factor CECc since all parameter intervals are equal.
banana_suit[["soil"]][["Factors Evaluated"]]
#> [1] "CFragm" "CECc"   "pHH2O"  "SoilTe"

# From the above result, there are four factors targetted
# by the input land unit, these are CFragm, CECc, pHH2O and 
# SoilTe. Suppose we know the maximum value that these factors 
# can take, say 60 for CFragm, 20 for CECc, 9 for pHH2O, and 10
# for SoilTe. We can specify these as follows:
banana_suit <- suit("banana", terrain=MarinduqueLT, mf="trapezoidal",
interval="unbias", maximum=c(60, 20, 9, 10))
banana_suit
#> $terrain
#> [1] "Error: No factor(s) to be evaluated, since none matches with the crop requirements. If water or temp characteristics was specified then maybe you forgot to specify the sow_month argument, read doc for suit."
#> 
#> $soil
#> [1] "Error: maximum length should be equal to the number of factors in the input land units."
#> 
# The result gave us an error. We understand the error 
# for terrain characteristics, but for soil it says that
# the argument `maximum` must be equal in length with the
# target factors specified in the input land unit datasets.
# We know that there should be 4 factors, but upon checking, 
# we see that the `MarinduqueLT` also have Lon and Lat columns,
# which ALUES assumes to be a target factor as well. Indeed, we 
# need to exclude these columns (those that are not the target 
# factors, rather spatial variables) when specifying `minimum` 
# or `maximum` constants. Thus, it should be:
MarinduqueLT2 <- MarinduqueLT[, 3:ncol(MarinduqueLT)]
banana_suit <- suit("banana", terrain=MarinduqueLT2, 
mf="trapezoidal", interval="unbias", maximum=c(60, 20, 9, 10))
head(banana_suit[["soil"]][["Suitability Score"]])
#>   CFragm   CECc pHH2O SoilTe
#> 1      0 0.7500     0      0
#> 2      1 0.7500     0      0
#> 3      0 0.7500     0      0
#> 4      0 0.7500     0      0
#> 5      0 0.7500     0      0
#> 6      0 0.8125     0      0
head(banana_suit[["soil"]][["Suitability Class"]])
#>   CFragm CECc pHH2O SoilTe
#> 1      N    N     N      N
#> 2     S1    N     N      N
#> 3      N    N     N      N
#> 4      N    N     N      N
#> 5      N    N     N      N
#> 6      N    N     N      N

## Sigma of Gaussian
# The `sigma` argument is used to specify the scale of the 
# Gaussian membership function. That is, it is only 
# applicable for `mf="gaussian"`.

# Other examples
library(ALUES)

rice_suit <- suit("ricebr", water=MarinduqueWater, 
temp=MarinduqueTemp, sow_month = 1)
lapply(rice_suit[["water"]], function(x) head(x)) # access results for water suitability
#> $`Factors Evaluated`
#> [1] "Jan" "Feb" "Mar" "Apr"
#> 
#> $`Suitability Score`
#>         Jan       Feb       Mar       Apr
#> 1 0.3051852 0.1925926 0.1629630 0.3542857
#> 2 0.3081481 0.1925926 0.1629630 0.3485714
#> 3 0.3081481 0.1955556 0.1659259 0.3485714
#> 4 0.3111111 0.1925926 0.1688889 0.3371429
#> 5 0.3111111 0.1925926 0.1718519 0.3371429
#> 6 0.3140741 0.1955556 0.1748148 0.3257143
#> 
#> $`Suitability Class`
#>   Jan Feb Mar Apr
#> 1  S3   N   N  S3
#> 2  S3   N   N  S3
#> 3  S3   N   N  S3
#> 4  S3   N   N  S3
#> 5  S3   N   N  S3
#> 6  S3   N   N  S3
#> 
#> $`Factors' Minimum Values`
#> Jan Feb Mar Apr 
#>   0   0   0   0 
#> 
#> $`Factors' Maximum Values`
#>   Jan   Feb   Mar   Apr 
#> 880.0 880.0 880.0 714.2 
#> 
#> $`Factors' Weights`
#> [1] NA NA NA NA
#> 
#> $`Crop Evaluated`
#> [1] "RICEBRWater"
#> 
lapply(rice_suit[["temp"]], function(x) head(x)) # access results for temperature suitability
#> $`Factors Evaluated`
#> [1] "Feb"
#> 
#> $`Suitability Score`
#>         Feb
#> 1 0.8366667
#> 2 0.8333333
#> 3 0.8400000
#> 4 0.8366667
#> 5 0.8366667
#> 6 0.8500000
#> 
#> $`Suitability Class`
#>   Feb
#> 1  S1
#> 2  S1
#> 3  S1
#> 4  S1
#> 5  S1
#> 6  S1
#> 
#> $`Factors' Minimum Values`
#> Feb 
#>   0 
#> 
#> $`Factors' Maximum Values`
#> Feb 
#>  52 
#> 
#> $`Factors' Weights`
#> [1] 2
#> 
#> $`Crop Evaluated`
#> [1] "RICEBRTemp"
#> 
rice_suit <- suit("ricebr", terrain=MarinduqueLT)
#> Warning: maximum is set to 16 for factor CECc since all parameter intervals are equal.
lapply(rice_suit[["terrain"]], function(x) head(x))
#> [[1]]
#> [1] "Error: No factor(s) to be evaluated, since none matches with the crop requirements. If water or temp characteristics was specified then maybe you forgot to specify the sow_month argument, read doc for suit."
#> 
lapply(rice_suit[["soil"]], function(x) head(x))
#> $`Factors Evaluated`
#> [1] "CFragm" "CECc"   "pHH2O" 
#> 
#> $`Suitability Score`
#>      CFragm   CECc pHH2O
#> 1 0.7843137 0.7500     0
#> 2 0.8235294 0.7500     0
#> 3 0.8039216 0.7500     0
#> 4 0.8039216 0.7500     0
#> 5 0.7647059 0.7500     0
#> 6 0.7843137 0.8125     0
#> 
#> $`Suitability Class`
#>   CFragm CECc pHH2O
#> 1     S1   S1     N
#> 2     S1   S1     N
#> 3     S1   S1     N
#> 4     S1   S1     N
#> 5     S1   S1     N
#> 6     S1   S1     N
#> 
#> $`Factors' Minimum Values`
#> CFragm   CECc  pHH2O 
#>      0      0      0 
#> 
#> $`Factors' Maximum Values`
#> CFragm   CECc  pHH2O 
#>   51.0   16.0    9.9 
#> 
#> $`Factors' Weights`
#> [1] NA NA NA
#> 
#> $`Crop Evaluated`
#> [1] "RICEBRSoil"
#> 
#> $Warning
#> [1] "maximum is set to 16 for factor CECc since all parameter intervals are equal."
#>