Compute cell (pixel) level "local" statistics across layers, and most return a single layer (the exception is range
).
The following summary methods are available for SpatRaster: mean, max, min, range, prod, sum, any, all
See reduce
to compute statistics that are not included here (e.g. median) or any other custom functions.
Because generic functions are used, the method applied is chosen based on the first argument: 'x
'. This means that if r
is a SpatRaster, mean(r, 5)
will work, but mean(5, r)
will not work.
To summarize the values of all cells by layer see layerStats
.