title: Writing a raster stack to file with changed names
body: <p>I changed the names of the 20 layers in my raster stack (Rstack) and then write the newly named stack to file but when I read the file back into R the names are not preserved so if I want to use the file I have to re-stack the rasters each time... Here is my code:</p>
  <pre><code>Rstack &lt;- Rstack[[name]] #changing names of layers to match model filenames
  
  writeRaster(Rstack, filename=&quot;Rstack.tif&quot;, options=&quot;INTERLEAVE=BAND&quot;, overwrite=TRUE)
  
  Rstack &lt;- raster(&quot;Rstack.tif&quot;) #read in the stack
  </code></pre>
  <p>But when I try to use the &quot;read-in&quot; stack I get an error that the names do not match the model order names - so I then have to restack and rename if I want to use the stack which takes a long time. Is there something I am missing in writeRaster() that would preserve the names after I change them?</p>