Re: [R] How to speed up interpolation

2011-07-18 Thread jim holtman
To recover the runways, try: levels(df$lrw)[times[, 'runway']] The 'runway' column has the index into 'levels(df$lrw)' On Mon, Jul 18, 2011 at 4:35 PM, James Rome wrote: > There is one problem. No matter what I do, I can't recover the correct > runway in the final list. > You had "rw = as.nume

Re: [R] How to speed up interpolation

2011-07-18 Thread James Rome
There is one problem. No matter what I do, I can't recover the correct runway in the final list. You had "rw = as.numeric(df$lrw) # index into 'levels' " I have tried df$lrw = factor(df$lrw, ordered=TRUE) rwys = factor(unique(df$lrw), ordered=TRUE)# Get the names of the runways > rwy

Re: [R] How to speed up interpolation

2011-07-17 Thread jim holtman
Here is what I did; convert the data to a numeric matrix for faster processing. You can convert back to a dataframe since you have the indices into the levels for the flights and runways. > # read in data > source('/temp/df/df') > # convert to matrix > df.mat <- cbind(pt = as.numeric(df$PredTime)

Re: [R] How to speed up interpolation

2011-07-17 Thread James Rome
I thought I had included the data... Here it is again. What I want to do is to make box and whisker plots with each flight counted the same number of times in each time bin. Hence the interpolation to minute time hacks. On 7/17/2011 4:16 PM, jim holtman wrote: > It would be nice if you had some

Re: [R] How to speed up interpolation

2011-07-17 Thread jim holtman
It would be nice if you had some sample data included so that we could see how the code worked. Have you use Rprof on the code to see where you are spending your time? You might want to use 'matrix' instead of 'data.frames' since there is a big performance impact with dataframes when indexing. A

[R] How to speed up interpolation

2011-07-17 Thread James Rome
df is a very large data frame with arrival estimates for many flights (DF$flightfact) at random times (df$PredTime). The error of the estimate is df$dt. My problem is that I want to know the prediction error at each minute before landing. This code works, but is very slow, and dominates everything.