Learn R Programming

terra (version 1.3-22)

diff: Lagged differences

Description

Compute the difference between consecutive layers in a SpatRaster.

Usage

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

Arguments

x

SpatRaster

lag

postive integer indicating which lag to use

filename

character. Output filename

...

additional arguments for writing files as in writeRaster

Value

SpatRaster

Examples

Run this code
# NOT RUN {
s <- rast(system.file("ex/logo.tif", package="terra"))   
d <- diff(s)
# }

Run the code above in your browser using DataLab