title: repeat same raster layer to create a raster stack
body: <p>I am trying to create a raster stack from a rasterlayer, where the raster stack is just the same raster layer repeated a certain number of times. </p>
  
  <p>I can do something like this:</p>
  
  <pre><code>library(raster)
  rasterstack &lt;- addLayer(rasterlayer, rasterLayer, rasterLayer) 
  </code></pre>
  
  <p>and this works. However, i want the stack to be about a 1000 layers. I guess i could just loop through, but i was wondering if there was a more sophisticated way to doing this. </p>
  
  <p>The reason I am trying to do this is to calculate the weighted mean of a raster stack with data where each layer is a different time period, and where the weights are in a different raster layer object. I am hoping that if I create a rasterstack from the weights raster  layer with the same number of layers as the data, I'll be able to do something like:</p>
  
  <pre><code>  weightedmean &lt;- weighted.mean( data.RasterStack, weights.RasterStack )
  </code></pre>