powered by
Apply a function to the values of each cell of two (multilayer) SpatRasters.
# S4 method for SpatRaster,SpatRaster xapp(x, y, fun, ..., filename="", overwrite=FALSE, wopt=list())
SpatRaster
SpatRaster with the same geometry as x
x
a function that operates on two vectors
additional arguments for fun. These are typically numerical constants. They should *never* be another SpatRaster
fun
character. Output filename
logical. If TRUE, filename is overwritten
TRUE
filename
list with named options for writing files as in writeRaster
writeRaster
app, lapp, tapp, Math-methods, roll
app
lapp
tapp
Math-methods
roll
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