nlayers | R Documentation |
VirtualArray
'-derived class objectFunction to return the length of the array in which elements are organized.
nlayers(x)
## S4 method for signature 'list'
nlayers(x)
## S4 method for signature 'SpatRaster'
nlayers(x)
## S4 method for signature 'VirtualArray'
length(x)
## S4 method for signature 'XArray'
nlayers(x)
## S4 method for signature 'RasterArray'
nlayers(x)
x |
a |
The length()
function returns the number elements that should be present based on the array structure itself, and not the total number of values stored in the object. As the object can contain missing values, the number of actual layers can be queried with nlayers
.
A numeric
value.
ex <- rastex()
# omit third element
ex[3] <- NA
# number of elements in the RasterArray
length(ex)
# remaining number values in the stack
length(ex@stack)
# the number of remaining layers in the RasterArray
nlayers(ex)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.