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)
Run the code above in your browser using DataLab