selectRange: Select the values of a range of layers, as specified by cell values in another SpatRaster
Description
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 1 and nlyr(x) (values outside this range are ignored).
See rapp for applying a function to a range of variable size.
See extract for extraction of values by cell, point, or otherwise.
Usage
# S4 method for SpatRaster
selectRange(x, y, z=1, repint=0, filename="", ...)