Number of elements or layers in a RasterArray or SpatialArray class object
Function to return the length of the array in which RasterLayers
are organized.
## S4 method for signature 'XArray' length(x) ## S4 method for signature 'XArray' nlayers(x) ## S4 method for signature 'SpatialStack' 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 (such as the length
method of RasterStack
s). As the object can contain missing values, the number of actual layers can be queried with nlayers
.
A numeric
value.
data(dems) # omit third element dems[3] <- NA # number of elements in the RasterArray length(dems) # remaining number values in the stack length(dems@stack) # the number of remaining layers in the RasterArray nlayers(dems)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.