minFn {reproducible} | R Documentation |
Get min or maximum value of a (Spat)Raster
Description
During the transition from raster to terra, some functions are not drop in
replacements, such as minValue
and maxValue
became terra::minmax
. This
helper allows one function to be used, which calls the correct max or min
function, depending on whether the object is a Raster
or SpatRaster
.
Usage
minFn(x)
maxFn(x)
dataType2(x, ...)
nlayers2(x)
values2(x, ...)
Arguments
x |
A |
... |
Passed to the functions in |
Value
A vector (not matrix as in terra::minmax
) with the minimum or maximum
value on the Raster
or SpatRaster
, one value per layer.
Examples
if (requireNamespace("terra", quietly = TRUE)) {
ras <- terra::rast(terra::ext(0, 10, 0, 10), vals = 1:100)
maxFn(ras)
minFn(ras)
}
[Package reproducible version 2.1.0 Index]