title: R: prediction from smooth.spline to interpolate to finer time scale
body: <p>Classic problem: data from different instruments is logged on different timescales. Here I have hourly environmental data (envdat) and I want to add a column to my response data (respdat) that has the environmental data. However, the response data has a point for every second, except that it is a subset for a voltage above a threshold (points are missing). My goal is to fit a curve to the environmental data (resembles a sine wave) and interpolate the value for each response observation. See example below:</p>
  
  <pre><code>envdat=structure(list(date.time = structure(c(1369552133, 1369555733, 
  1369559333, 1369562933, 1369566533, 1369570133, 1369573733, 1369577333, 
  1369580933, 1369584533, 1369588133, 1369591733, 1369595333, 1369598933, 
  1369602533, 1369606133, 1369609733, 1369613333, 1369616933, 1369620533, 
  1369624133, 1369627733, 1369631333, 1369634933), class = c("POSIXct", 
  "POSIXt"), tzone = ""), cool.C = c(9.866, 9.077, 9.077, 6.573, 
  6.573, 6.573, 9.669, 9.472, 9.373, 11.334, 11.334, 11.236, 13.75, 
  13.942, 13.076, 16.713, 16.808, 16.808, 14.23, 14.325, 14.421, 
  11.625, 11.625, 12.207)), .Names = c("time", "temp"), row.names = 63:86, class =     "data.frame")
  plot(data$time,data$temp,type="b")
  myspline=smooth.spline(data$time,data$temp,spar=.5)
  lines(myspline,col="red")
  ####
  respdat=structure(list(time = structure(c(1369606346, 1369606356, 
  1369606359, 1369606360, 1369606361, 1369606362, 1369606363, 1369606364, 
  1369606365, 1369606366, 1369606367, 1369606368, 1369606369, 1369606370, 
  1369606371, 1369606372, 1369606373, 1369606374, 1369606375, 1369606376, 
  1369606377, 1369606378, 1369606379, 1369606380, 1369606381), class = c("POSIXct", 
  "POSIXt"), tzone = ""), volts = c(2.511094, 2.509647, 2.524574, 
  2.954419, 2.756494, 2.59868, 2.94975, 2.87183, 2.846382, 2.788386, 
  3.144585, 3.099345, 2.931733, 3.032537, 2.870383, 2.869857, 2.841319, 
  2.886822, 2.750839, 3.109142, 3.017413, 3.1194, 2.909508, 2.899776, 
  2.903129)), .Names = c("time", "volts"), row.names = c(4036L, 
  4046L, 4049L, 4050L, 4051L, 4052L, 4053L, 4054L, 4055L, 4056L, 
  4057L, 4058L, 4059L, 4060L, 4061L, 4062L, 4063L, 4064L, 4065L, 
  4066L, 4067L, 4068L, 4069L, 4070L, 4071L), class = "data.frame")
  print(respdat)
  </code></pre>
  
  <p>My approach was:</p>
  
  <pre><code>test=predict(myspline,respdat$time)
  </code></pre>
  
  <p>This returns an error. Guidance welcomed.</p>