powered by
Substitute(replace) cell values of a SpatRaster with a new value. See classify for more complex/flexible replacement.
classify
# S4 method for SpatRaster subst(x, from, to, filename="", ...)
SpatRaster
numeric value(s)
a single numeric value
character. Output filename
Additional arguments for writing files as in writeRaster
writeRaster
# NOT RUN { r <- rast(ncol=5, nrow=5, xmin=0, xmax=1, ymin=0, ymax=1, crs="") r <- init(r, 1:6) x <- subst(r, 3, 7) x <- subst(r, 2:3, NA) x <- subst(x, NA, 10) # }
Run the code above in your browser using DataLab