R + OMX: Trip Length Frequency Plots
If you don't follow me on twitter or the Open Model Data site, you may have missed that Cube 6.4 makes some DLL changes that rendered the prior version of the Cube2OMX converter unusable. I jumped in (partly because I installed Cube 6.4) and fixed the problem. You can get the source or a binary on Github.
I did this because sending matrices to DBF files means that you'll have a 500 MB DBF for a matrix that's 3200+ zones. Normal R routines chug on it. On the contrary, OMX files are around 10% of that size (60 MB) and R can read them quite quickly - in a matter of seconds instead of minutes.
So the first thing I wanted to do in R with OMX files is Trip Length Frequency Plots. This isn't incredibly quick, but it works. The code is below. According to one run in R, it takes around 6 minutes to run (on 3,312 zones). The largest part is the loop in the function, and this could probably be parallelized (is that a word?) using doParallel.
Code below or here...