
Where are the cells with the min or max values?
where.RdThis method returns the cell numbers for the cells with the min or max values of each layer in a SpatRaster.
Usage
# S4 method for class 'SpatRaster'
where.min(x, values=TRUE, list=FALSE)
# S4 method for class 'SpatRaster'
where.max(x, values=TRUE, list=FALSE)See also
which and Summary-methods for which.min and which.max
Examples
f <- system.file("ex/elev.tif", package="terra")
r <- rast(f)
where.min(r)
#> layer cell value
#> [1,] 1 7770 141
#> [2,] 1 8055 141