Skip to contents

Compute the difference between consecutive layers in a SpatRaster.

Usage

# S4 method for class 'SpatRaster'
diff(x, lag=1, filename="", ...)

Arguments

x

SpatRaster

lag

positive integer indicating which lag to use

filename

character. Output filename

...

additional arguments for writing files as in writeRaster

Value

SpatRaster

Examples

s <- rast(system.file("ex/logo.tif", package="terra"))   
d <- diff(s)