I have several raster brick objects that I would like to combine into one raster with multiple field values for each cell, but I am not sure how to do this in R.
For example, let's say I have two layers in a 2*2 raster brick.
r <-raster(nrow=2,ncol=2)
r[] <- round(runif(ncell(r))* 10,0)
s <-raster(nrow=2,ncol=2)
s[] <- round(runif(ncell(r))* 10,0)
t = brick(r,s)
I would like to combine the values for r and s into a single raster with multiple values (at the object@data@attributes slot, I think) associated with each cell.
So, in the above example, if cell 1 = 1 in r and cell 1 = 2 in s, then the output that I desire is that the resulting raster contain two fields at @data@attributes, the first field = 1 and the second field = 2.