The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

As already emphasized in Article 2, the following are the crop datasets available in ALUES:

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"

In cases were the target crop is not available in the ALUES database, users can specify their own by following the template of a crop requirement dataset. For example,

library(ALUES)
COFFEEARSoil
##       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>   1
## 3    CaCO3  5.0  2.0   1.0 <NA> <NA> <NA>   3
## 4     Gyps  3.0  2.0   0.5 <NA> <NA> <NA>   3
## 5     CECc  8.0 10.0  16.0 <NA> <NA> <NA>   2
## 6       BS 20.0 35.0  50.0 <NA> <NA> <NA>   2
## 7   SumBCs  1.6  2.8   4.0 <NA> <NA> <NA>   2
## 8    pHH2O  5.2  5.4   5.6  6.6  7.4  7.8   2
## 9       OC  0.7  0.8   1.2 <NA> <NA> <NA>   3
## 10   ECedS  2.0  0.5   0.5 <NA> <NA> <NA>   3
## 11  SoilTe  3.0  4.0   9.0 <NA> <NA> <NA>   2

The above data frame shows us the first column as the code of the target factors, and the remaining of the columns are the suitability classes with the last column for the weights if any.

Crop Characteristics

It should be noted that apart from the proper templating of the dataframe for any new target crop, the categorization of the characteristics must be observed as well. That is, for any new crop, the four characteristics: terrain, soil, water, and temp, must be encoded separately as one dataframe. That is, for any target crop there will be four dataframes to expect for the four characteristics mentioned.

Creating from a template

To create a custom crop dataset, use the following code to generate an empty row data frame with the appropriate column name

new_crop <- data.frame(matrix(nrow=0, ncol=ncol(COFFEEARSoil)))
names(new_crop) <- names(COFFEEARSoil)
new_crop
## [1] code s3_a s2_a s1_a s1_b s2_b s3_b wts 
## <0 rows> (or 0-length row.names)

Needless to say, any ALUES crop dataset can be used above in place of COFFEEARSoil, since all crop datasets have the same column names.

Next is to enter the name of the factors in the first column, and then the corresponding standard values for suitability classes. Suppose for example, the new crop demands a factor CFragm to be S3 (marginally suitable) if it is 60, S2 if it is 40, and S1 if it is 20; then this can be entered as follows:

new_crop[1, "code"] <- "CFragm"
new_crop[1, 2:4] <- c(60, 40, 20)
new_crop
##     code s3_a s2_a s1_a s1_b s2_b s3_b wts
## 1 CFragm   60   40   20   NA   NA   NA  NA

New factors can be added further in the succeeding rows, say for row 2 we have pHH2O with the following data

new_crop[2, "code"] <- "pHH2O"
new_crop[2, 2:7] <- c(4.5, 5.0, 5.1, 5.6, 6.2, 6.9)
new_crop
##     code s3_a s2_a s1_a s1_b s2_b s3_b wts
## 1 CFragm 60.0   40 20.0   NA   NA   NA  NA
## 2  pHH2O  4.5    5  5.1  5.6  6.2  6.9  NA

Adding weight to pHH2O is done as follows:

new_crop[2, "wts"] <- 2
new_crop
##     code s3_a s2_a s1_a s1_b s2_b s3_b wts
## 1 CFragm 60.0   40 20.0   NA   NA   NA  NA
## 2  pHH2O  4.5    5  5.1  5.6  6.2  6.9   2

Now suppose we want to evaluate Marinduque land units for this new crop, we can do this as follows:

newcrop_suit <- suit(new_crop, terrain=MarinduqueLT)
lapply(newcrop_suit[["terrain"]], function (x) head(x))
## $`Factors Evaluated`
## [1] "CFragm" "pHH2O" 
## 
## $`Suitability Score`
##   CFragm pHH2O
## 1 0.8625     0
## 2 0.8875     0
## 3 0.8750     0
## 4 0.8750     0
## 5 0.8500     0
## 6 0.8625     0
## 
## $`Suitability Class`
##   CFragm pHH2O
## 1     S1     N
## 2     S1     N
## 3     S1     N
## 4     S1     N
## 5     S1     N
## 6     S1     N
## 
## $`Factors' Minimum Values`
## CFragm  pHH2O 
##      0      0 
## 
## $`Factors' Maximum Values`
## CFragm  pHH2O 
##  80.00   7.38 
## 
## $`Factors' Weights`
## [1] NA  2
## 
## $`Crop Evaluated`
## [1] "Custom Crop for Terrain"

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.