I have a list of raster bricks that have a date value in the z slot. I am trying to perform weekly averages across this list. For example, if my list had one brick for each day of a single week, I would like a single brick returned with the mean values for each layer. Each brick has four layers.
Here's what the first brick in the list looks like:
r[] [] class : RasterBrick dimensions : 55, 77, 4235, 4 (nrow, ncol, ncell, nlayers) resolution : 0.0118, 0.00833 (x, y) extent : -123.2119, -122.3033, 45.23524, 45.69339 (xmin, xmax, ymin, ymax) coord. ref. : +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0 data source : in memory names : b1, b2, b3, b4 min values : 0.02034729, 0.02034729, 0.01428941, 0.01428941 max values : 0.3123032, 0.3123032, 0.2410000, 0.2410000 time : 2017-09-11, 2017-09-11, 2017-09-11, 2017-09-11
setZ() to add the date to each layer in the brick. This gets automatically converted into the time slot above. The dates of the first brick can be accessed this way:
r[]@z$time  "2017-09-11" "2017-09-11" "2017-09-11" "2017-09-11"
How can I take this list of raster bricks and convert them into a single