[R-sig-finance] Sorting

Sean O'Riordain sean.oriordain at gmail.com
Wed Nov 16 10:32:28 CET 2005


Good Morning Lorenzo,

I had a look at ?sort and it said "For ordering along more than one
variable, e.g., for sorting data frames, see 'order'." So I had a look
at ?order... and popped down to the examples and it talks about
ordering a dataframe - not the clearest of examples, but hey :-) 
Sometimes the obvious is the hardest to see :-)

cheers!
Sean


On 16/11/05, L.Isella <L.Isella at myrealbox.com> wrote:
> 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
>
> _______________________________________________
> R-sig-finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>



More information about the R-sig-finance mailing list