[R-sig-finance] Sorting

L.Isella L.Isella at myrealbox.com
Wed Nov 16 10:17:44 CET 2005


Dear All,
I have a long array (say 2xN, with N of the order of 10^5 at least) made up of couples of numerical values.
I would like to sort these N couples in increasing order of the value of the numbers in the lower row.
It is very easy to use sort() to take care of the sorting of the lower row, but then I also have to sort the upper row so that the values of each couple still match.
I did it using a double loop, but for large N this is very slow.
This is really a bottleneck in my code...
Any suggestions?
Regards

Lorenzo



More information about the R-sig-finance mailing list