title: Merging multiple rasters in R
body: <p>I've been trying to find a time-efficient way to merge multiple raster images in R. These are adjacent ASTER scenes from the southern Kilimanjaro region, and my target is to put them together to obtain one large image.</p>
  
  <p>This is what I got so far (object 'ast14dmo' representing a list of RasterLayer objects):</p>
  
  <pre><code># Loop through single ASTER scenes
  for (i in seq(ast14dmo.sd)) {
    if (i == 1) {
      # Merge current with subsequent scene
      ast14dmo.sd.mrg &lt;- merge(ast14dmo.sd[[i]], ast14dmo.sd[[i+1]], tolerance = 1)
    } else if (i &gt; 1 &amp;&amp; i &lt; length(ast14dmo.sd)) {
      tmp.mrg &lt;- merge(ast14dmo.sd[[i]], ast14dmo.sd[[i+1]], tolerance = 1)
      ast14dmo.sd.mrg &lt;- merge(ast14dmo.sd.mrg, tmp.mrg, tolerance = 1)
    } else {
      # Save merged image
      writeRaster(ast14dmo.sd.mrg, paste(path.mrg, "/AST14DMO_sd_", z, "m_mrg", sep = ""), format = "GTiff", overwrite = TRUE)
    }
  }
  </code></pre>
  
  <p>As you surely guess, the code works. However, merging takes quite long considering that each single raster object is some 70 mb large. I also tried Reduce and do.call, but that failed since I couldn't pass the argument 'tolerance' which circumvents the different origins of the raster files.</p>
  
  <p>Anybody got an idea of how to speed things up? </p>