title: Fitting a spline function in R to interpolate daily values from monthly values
body: <p>Take a data frame that looks like this and contains data for some dates in 2005 and a measurement at each date. </p>
  
  <pre><code>df &lt;- data.frame("date" = c('2005-04-04','2005-04-19', '2005-04-26', '2005-05-05', 
  '2005-05-12', '2005-05-25', '2005-06-02', '2005-06-16', '2005-07-07', '2005-07-14', 
  '2005-07-21', '2005-08-04'), "numbers" = c(90,50,50,48,44,37,34,30,36,31,49,54))
  </code></pre>
  
  <p>I want to create a sequence of values from 1:365 based on this for each day of the year, essentially to create a new data frame from 01/01/2005 to 31/12/2005 which has been infilled with the values from a spline function fitting over these  existing 12 values. </p>
  
  <p>When I try to do this using:</p>
  
  <pre><code>numbers &lt;- df$numbers
  x = spline(1:365, numbers)
  </code></pre>
  
  <p>I get</p>
  
  <blockquote>
    <p>Error in xy.coords(x, y, setLab = FALSE) : 'x' and 'y' lengths differ'</p>
  </blockquote>
  
  <p>I'm not sure what is going wrong.</p>