Well I have read a lot of forums and actually managed to implement a code in R to solve my question. However it takes 2 hours.
Does anyone know how to calculate the mean of a stack or brick raster (multi-band raster) based on a vector file in R?
Imagine this like a sandwich with various layers (raster bands). Then we press with one finger (vector file). I want the mean of all the pixels or cells through the layers.