powered by
nlayers(x)
names
r <- raster(ncols=10, nrows=10) r[] <- 1:ncell(r) s <- stack(r, r, r) nlayers(s) s <- stack(s,s) nlayers(s) s <- dropLayer(s, 2:3) nlayers(s)
Run the code above in your browser using DataLab