| predict | R Documentation | 
Make spatial predictions with a QUEFTS model. First create a model, then use the model with a SpatRaster of soil properties to make spatial predictions.
## S4 method for signature 'Rcpp_QueftsModel'
predict(object, supply, yatt, leaf_ratio, stem_ratio, 
		var="yield", filename="", overwrite=FALSE, ...)
| object | QUEFTSModel | 
| supply | SpatRaster with nutrient supply data (Ns, Ps, Ks) | 
| yatt | SpatRaster with attainable yield | 
| leaf_ratio | positive numeric (typically between 0 and 1) indicating the leaf weight relative to the storage organ weight. For example: 0.46 for maize, 0.17 for potato, and 0.18 for rice | 
| stem_ratio | positive numeric (typically between 0 and 1) indicating the stem weight relative to the storage organ weight, For example: 0.56 for maize, 0.14 for potato, and 0.67 for rice | 
| var | character. Output variable name. Either "yield" or "gap" | 
| filename | character. Output filename. Optional | 
| overwrite | logical. If  | 
| ... | list. Options for writing files as in  | 
SpatRaster
library(terra)
ff <- list.files(system.file("sp", package="Rquefts"), full.names=TRUE)
r <- rast(ff)
soil <- r[[c("Tavg", "pH", "SOC", "Kex", "Pex", "Ptot")]]
supply <- lapp(soil, nutSupply2)
plot(supply)
yatt <- rast(system.file("sp/Ya.tif", package="Rquefts"))
maize <- quefts_crop("Maize")
fertilizer <- list(N=0, P=0, K=0)
q <- quefts(crop=maize, fert=fertilizer)
p <- predict(q, supply, yatt, 0.46, 0.56)
plot(p)
g <- predict(q, supply, yatt, 0.46, 0.56, "gap")
plot(g)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.