
Last chance! 50% off unlimited learning
Sale ends in
y
should have cell values between 1
and nlayers(x)
. The values of y
are rounded.
See extract
for extraction of values by cell, point, or otherwise.## S3 method for class 'RasterStackBrick,Raster':
stackSelect(x, y, recycle=FALSE, type='index', filename='', ...)
FALSE
. Only relevant if y
has multiple layers. E.g. if x
has 12 layers, and y
has 4 layers, the indices of the y
layers are used three times.recycle=TRUE
. Can be 'index' or 'truefalse'. If it is 'index', the cell values of y
should represent layer numbers. If it is 'truefalse' layer numbers are indicated by 0 (not used, NA returned) and 1writeRaster
stackApply
, extract
r <- raster(ncol=10, nrow=10)
r[] <- 1
s <- stack(r, r+2, r+5)
r[] <- round((runif(ncell(r)))*3)
x <- stackSelect(s, r)
Run the code above in your browser using DataLab