| rcl | R Documentation |
Get a matrix with the combination of row, column, and layer numbers
## S4 method for signature 'SpatRaster'
rcl(x, row=NULL, col=NULL, lyr=NULL)
x |
SpatRaster |
row |
positive integer that are row number(s), a list thereof, or NULL for all rows |
col |
as above for columns |
lyr |
as above for layers |
If a list is used for at least one of row, col or lyr, these are evaluated in parallel. That is combinations are made for each list element, not across list elements. If, in this case another argument is not a list it has to have either length 1 (used for all cases) or have the same length as the (longest) list, in which case the value is coerced into a list with as.list
If multiple arguments are a list but they have different lengths, theyare recycled to the longest list.
matrix
rowColCombine, cellFromRowCol
x <- rast(ncol=5, nrow=5, nlyr=2)
values(x) <- 1:size(x)
rcl(x, 1, 2:3, 1:2)
i <- rcl(x, 1, list(1:2, 3:4), 1:2)
i
# get the values for these cells
x[i]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.