Displaying 1 result from an estimated 1 matches for "interpolatetim".
Did you mean:
interpolatetimes
2011 Jul 17
1
How to speed up interpolation
...s)
flights = as.data.frame(flights)
times = data.frame()
# Split by flight
for(i in 1:nflights) {
tf = df[as.numeric(df$flightfact)==flights[i,1],] # This flight
#check for at least 2 entries
if(dim(tf)[1] < 2) {
next
}
idf = interpolateTimes(tf)
times = rbind(times, idf)
}
# Interpolate the times to every minute for 60 minutes
# Return a new data frame
interpolateTimes = function(df) {
x = as.numeric(seq(from=0,to=60)) # The times to interpolate to
dti = approx(as.numeric(df$PredTime), as.numeric(df$dt), x,
method=...