title: How to write rasters after stacking them?
body: <p>There are several raster files that I want to manipulate and then write them again.</p>
  
  <pre><code>rasterfiles   &lt;- list.files("C:\\data", "*.envi", full.names = TRUE)
  d1 &lt;-  overlay(stack(rasterfiles ), 
                 fun=function(x) movingFun(x, fun=mean, n=3, na.rm=TRUE))
  d2=unstack(d1)
  </code></pre>
  
  <p>I am grateful to any idea on how we write <code>d2</code> (rasters)</p>