Substitute(replace) cell values of a SpatRaster with a new value. See classify for more complex/flexible replacement.
Usage
# S4 method for SpatRaster
subst(x, from, to, filename="", ...)
Arguments
x
SpatRaster
from
numeric value(s)
to
numeric value(s). Normally a vector of the same length as `from`. If x has a single layer, it can also be a matrix of numeric value(s) where nrow(x) == length(from). In that case the output has multiple layers, one for each column in to
filename
character. Output filename
...
Additional arguments for writing files as in writeRaster