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!
As an example if I have the array, old:
old <- 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 ...
what I would like to do is make the array new:
new <- interp2d(old, newx=6, newy=5)
i.e. I want to change the dimensions of the array so that new is a 6*5 array of the old data — in this example it would be important to preserve the totals in the old 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!
Here’s a start, but not I’m sure it does what you want (preserve totals). In fact, I’m not sure I see how you can exactly preserve the totals when you’re coarsening in this way … unless you’d rather “bin” than “interpolate”?