Description Usage Arguments Value See Also Examples
Extract a set of layers from a RasterStack or RasterBrick object.
1 2 3 4 5 |
x |
RasterBrick or RasterStack object |
subset |
integer or character. Should indicate the layers (represented as integer or by their name) |
drop |
If |
filename |
character. Output filename (optional) |
... |
additional arguments as for |
Raster* object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | s <- stack(system.file("external/rlogo.grd", package="raster"))
sel <- subset(s, 2:3)
# Note that this is equivalent to
sel2 <- s[[2:3]]
# and in this particular case:
sel3 <- dropLayer(s, 1)
nlayers(s)
nlayers(sel)
# effect of 'drop=FALSE' when selecting a single layer
sel <- subset(s, 2)
class(sel)
sel <- subset(s, 2, drop=FALSE)
class(sel)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.