title: How to extract raster layer names from raster stack R?
body: <p>I have a raster stack that I created from a geotiff:</p>
  
  <pre><code>ras = "C:/temp/subset.tif"
  b1 = raster(ras, band = 1)
  b2 = raster(ras, band = 2)
  b3 = raster(ras, band = 3)
  
  sf = stack(b1, b2, b3)
  </code></pre>
  
  <p>Printing the stack yields the following information:</p>
  
  <pre><code>&gt; print(sf)
  class       : RasterStack 
  dimensions  : 701, 1151, 806851, 3  (nrow, ncol, ncell, nlayers)
  resolution  : 1, 1  (x, y)
  extent      : 301259.5, 302410.5, 4694849, 4695550  (xmin, xmax, ymin, ymax)
  coord. ref. : +proj=utm +zone=13 +datum=NAD83 +units=m +no_defs +ellps=GRS80 +towgs84=0,0,0 
  names       : subset.1, subset.2, subset.3 
  min values  :       51,       64,       65 
  max values  :      229,      224,      218
  </code></pre>
  
  <p>How can I extract a single layer name from the stack?  For example:</p>
  
  <pre><code>'subset.1'
  </code></pre>