where function

Where are the cells with the min or max values?

Where are the cells with the min or max values?

This method returns the cell numbers for the cells with the min or max values of each layer in a SpatRaster. methods

## S4 method for signature 'SpatRaster' where.min(x, values=TRUE, list=FALSE) ## S4 method for signature 'SpatRaster' where.max(x, values=TRUE, list=FALSE)

Arguments

  • x: SpatRaster
  • values: logical. If TRUE the min or max values are also returned
  • list: logical. If TRUE a list is returned instead of a matrix

Returns

matrix or list

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)
  • Maintainer: Robert J. Hijmans
  • License: GPL (>= 3)
  • Last published: 2025-02-26