Thursday 29 August 2013

Raster overlay from a matrix

Raster overlay from a matrix

I have a matrix of 100 raster layers and I'd like to create one new layer
that is the average. I understand if there were two layers I could simply
use the overlay function or perhaps just use c <- mean (a, b). However,
I'm not sure how to proceed with the matrix.
Here is sample of the matrix:
[[1]]
class : RasterLayer
dimensions : 175, 179, 31325 (nrow, ncol, ncell)
resolution : 1, 1 (x, y)
extent : 0, 179, 0, 175 (xmin, xmax, ymin, ymax)
coord. ref. : NA
data source : in memory
names : layer
values : 0, 100 (min, max)
I have tried
a.avg <- mean (a.total[,])
and I receive the error argument is not numeric or logical: returning NA

No comments:

Post a Comment