title: 2d bilinear interpolation in R
body: <p>I have some multidimensional data structures that I need to do some interpolation on. I'm really finding it difficult to get an example of how to do this in R!</p>
  
  <p>As an example if I have the array, <code>old</code>:</p>
  
  <pre><code>old &lt;- array(runif(10*12), dim=c(12,10))
  
  str(old)
  num [1:12, 1:10] 0.763 0.429 0.792 0.923 0.476 ...
  </code></pre>
  
  <p>what I would like to do is make the array <code>new</code>:</p>
  
  <pre><code>new &lt;- interp2d(old, newx=6, newy=5) 
  </code></pre>
  
  <p>i.e. I want to change the dimensions of the array so that new is a 6*5 array of the <code>old</code> data -- in this example it would be important to preserve the totals in the <code>old</code> grid. The line above is an example of what I would like to do, I don't know how to and was hoping someone would??! Thanks!</p>