How to obtain Dates of annual maximum gridcell values of rasterbrick?
问题 How can i get two rasters that gives the maximum value for each grid cells per year and also gives the dates on which that maximum value has occured. Below is the reproducible example with some steps i have implemented. library(raster) # Create a raster r1 <- raster(nrow=10, ncol=7) r <- stack(setValues(r1, runif(ncell(r1))), setValues(r1, runif(70 ,0.6,0.9)), setValues(r1, runif(70 ,0.2,0.4)), setValues(r1, runif(70 ,1,2)), setValues(r1, runif(70 ,0.5,1.0)), setValues(r1, runif(70 ,0.3,0.9))