which.min {raster} | R Documentation |
Which cells have the minumum / maximum value (for a RasterLayer), or which layer has the minimum/maximum value (for a RasterStack or RasterBrick)?
which.min(x) which.max(x)
x |
Raster* object |
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
## 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)