which.min {raster} | R Documentation

## Where is the min or max value?

### Description

Which cells have the minumum / maximum value (for a RasterLayer), or which layer has the minimum/maximum value (for a RasterStack or RasterBrick)?

### Usage

    which.min(x)
    which.max(x)

### Arguments

`x` | Raster* object

### Value

vector of cell numbers (if `x` is a RasterLayer) or (if `x` is a RasterStack or RasterBrick) a RasterLayer giving the number of the first layer with the minimum or maximum value for a cell

### See Also

`Which`

### Examples

    ## Not run:
    b <- brick(system.file("external/rlogo.grd", package="raster"))

    r <- which.min(b)

    i <- which.min(b[[3]])
    xy <- xyFromCell(b, i)
    plot(b[[3]])
    points(xy)

    ## End(Not run)

[Package raster version 2.5-2 Index]