title: (Linear) Interpolation in R for data frame (ddply)
body: <p>I need to interpolate annual data from a 5-year interval and so far I found how to do it for one observation using approx(). But I have a large data set and when trying to use ddply() to apply for each row, no matter what I try in the last row of code I keep receiving error messages.</p>
  
  <p>e.g:</p>
  
  <pre><code>   town &lt;- data.frame(name = c("a","b","c"), X1990 = c(100,300,500), X1995=c(200,400,700))
     d1990 &lt;-c(1990)
     d1995 &lt;-c(1995)
     town_all &lt;- cbind(town,d1990,d1995)
  
  
      library(plyr)
      Input &lt;- data.frame(town_all)
      x &lt;- c(town_all$X1990, town_all$X1995)
      y &lt;- c(town_all$d1990, town_all$d1995)
      approx_frame &lt;- function(df) (approx(x=x, y=y, method="linear", n=6, ties="mean"))
      ddply(Input, town_all$X1990, approx_frame)
  </code></pre>
  
  <p>Also, if you know what function calculates geometric interpolation, it will be great. (I was only able to find examples of spline or constant methods.) </p>