Use a single layer SpatRaster to select cell values from different layers in a multi-layer SpatRaster. The values of the SpatRaster to select layers (
y) should be whole numbers between
nlyr(x) (values outside this range are ignored).
rapp for applying a function to a range of variable size.
extract for extraction of values by cell, point, or otherwise.
# S4 method for SpatRaster selectRange(x, y, z=1, repint=0, filename="", ...)
SpatRaster. Cell values must be positive integers. They indicate the first layer to select for each cell
positive integer. The number of layers to select
integer > 1 and < nlyr(x) allowing for repeated selection at a fixed interval. For example, if
x has 36 layers, and the value of a cell in
repint = 12, the values for layers 2, 14 and 26 are returned
character. Output filename
additional arguments for writing files as in