
which.min(x)
which.max(x)
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 cellWhich
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)
Run the code above in your browser using DataLab