To be honest, 80% of the code was getting the data into the right shape and the other 20% was a slow implementation of the great circle calculations (I didn't know about the geosphere package so I rolled my own). Nathan's code is better.