Dear list,

I have a RasterLayer that contains 365 bands with a dimension of 1032,
1656, 1708992  (nrow, ncol, ncell).

library(raster)
img <- list.files(pattern='\\.img$')
stack <- stack(img)
data2002 <- writeRaster(stack, filename="2002.tif", format="GTiff",
overwrite=TRUE)

1. How could I produce a raster layer that contains a maximum value from
365 bands for each pixel?
I tried maxValue() but that only give me a maximum value for each band.

2. If I manage to do step 1, is it possible to know from which band is
actually the maximum value originate?

	[[alternative HTML version deleted]]

