powered by
Compute the difference between consecutive layers in a SpatRaster.
# S4 method for SpatRaster diff(x, lag=1, filename="", ...)
SpatRaster
positive integer indicating which lag to use
character. Output filename
additional arguments for writing files as in writeRaster
writeRaster
s <- rast(system.file("ex/logo.tif", package="terra")) d <- diff(s)
Run the code above in your browser using DataLab