When I use "aggregate" (package raster) on a multi-layer stack, with a
function such as "mean", it returns a second multi-layer stack at the
aggregated resolution. The function is applied separately to values from
each layer in turn.
What I want to do is send the vector/matrix of values extracted across all
layers to the user-defined function, which returns a single value that
would then go to form the output, a single layer raster or stack.
I can do this for a focal function using package spatial.tools, e.g.:

v<-rasterEngine(w,fun=mean,window_dims = c(15,15,3))  ## for a 3 band stack
with a window size of 15 by 15.

But I just need the value at the aggregate resolution, so running a focal
function takes ~200 times longer than necessary in this case.
Is it possible to use raster::aggregate or another function to do a similar
multi-layer operation?

	[[alternative HTML version deleted]]

