Learn R Programming

terra (version 1.8-80)

xapp: Apply a function to the cells of two SpatRasters

Description

Apply a function to the values of each cell of two (multilayer) SpatRasters.

Usage

# S4 method for SpatRaster,SpatRaster
xapp(x, y, fun, ..., filename="", overwrite=FALSE, wopt=list())

Arguments

Value

SpatRaster

See Also

app, lapp, tapp, Math-methods, roll

Examples

Run this code
r <- rast(ncols=10, nrows=10, nlyr=5)
set.seed(1)
r <- init(r, runif)
s <- init(r, runif)
x <- xapp(r, s, fun=cor)

Run the code above in your browser using DataLab