title: Resizing a raster to match specific dimensions in R
body: <p>I want to resize (enlarge in this case) a raster to match the dimensions of another.  Using <code>disaggregate</code> I can enlarge the raster, but the resize factor argument only accepts integers, so the output is closer to but not matching the target dimensions.  The following example illustrates by trying to resize <code>ras2</code> to match <code>ras1</code> dimensions:</p>
  
  <pre><code>&gt; require(raster)
  &gt; ras1 = raster(volcano)
  &gt; ras2 = aggregate(raster(apply(volcano, 1, rev)), fact=2, FUN=mean) # aggregated &amp; rotated
  &gt; extent(ras1) = extent(ras2) = c(0,100,0,100)
  &gt; crs(ras1) = crs(ras2) = '+init=epsg:27700'
  &gt; fact = c(ncol(ras1) / ncol(ras2), nrow(ras1) / nrow(ras2))
  &gt; ras2_resized = disaggregate(ras2, fact, method='')
  &gt; dim(ras2_resized)
  [1] 93 44  1
  &gt; dim(ras1)
  [1] 87 61  1
  </code></pre>
  
  <p>Grateful if anyone knows of a way to specify the dimensions of a resize instead of factor.  Thanks in advance.</p>
  
  <p>Bonus for a generalised method that can resizing either way not just enlarging, but this isn't the priority.</p>