Skip to content
Prev 28465 / 29559 Next

Crossing multiple raster to obtain a list of available values for each cell - LULCC package

Hello,

I am unfamiliar with the LULCC package, but what you describe sounds
to me like a simple extraction at one or more cell locations. At
least, that is what I think you describe here...
I think that is a simple matter of raster::extract().

###
library(raster)

nr <- 3
nc <- 4
ncell <- nr * nc
m <- matrix(seq_len(ncell), nc = nc, nr = nr)

one <- raster(m)
two <- raster(m * 2)
three <- raster(m * 3)

S <- stack(one, two, three)

extract(S, c(1, 3, ncell))
#      layer.1 layer.2 layer.3
# [1,]       1       2       3
# [2,]       7      14      21
# [3,]      12      24      36
###

Have I understood the issue?

Ben
On Fri, Nov 27, 2020 at 6:59 AM David Garc?a ?lvarez <dagaral at ugr.es> wrote: