EVOLUTION-MANAGER
Edit File: subset.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Subset layers in a Raster* object</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for subset {raster}"><tr><td>subset {raster}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Subset layers in a Raster* object</h2> <h3>Description</h3> <p>Extract a set of layers from a RasterStack or RasterBrick object. </p> <h3>Usage</h3> <pre> ## S4 method for signature 'Raster' subset(x, subset, drop=TRUE, filename='', ...) ## S4 method for signature 'RasterStack' subset(x, subset, drop=TRUE, filename='', ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>RasterBrick or RasterStack object</p> </td></tr> <tr valign="top"><td><code>subset</code></td> <td> <p>integer or character. Should indicate the layers (represented as integer or by their name)</p> </td></tr> <tr valign="top"><td><code>drop</code></td> <td> <p>If <code>TRUE</code>, a selection of a single layer will be returned as a RasterLayer</p> </td></tr> <tr valign="top"><td><code>filename</code></td> <td> <p>character. Output filename (optional)</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>additional arguments as for <code><a href="writeRaster.html">writeRaster</a></code></p> </td></tr> </table> <h3>Value</h3> <p>Raster* object </p> <h3>See Also</h3> <p><code><a href="addLayer.html">dropLayer</a></code></p> <h3>Examples</h3> <pre> 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) </pre> <hr /><div style="text-align: center;">[Package <em>raster</em> version 3.3-13 <a href="00Index.html">Index</a>]</div> </body></html>