Re: sort procedure

• To: mathgroup at smc.vnet.net
• Subject: [mg52495] Re: sort procedure
• From: Peter Pein <petsie at arcor.de>
• Date: Tue, 30 Nov 2004 05:23:57 -0500 (EST)
• References: <coefho\$rei\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```paolo wrote:
> If I have a data serie of n paired observations (x_t,x_t-1) ordered according to time, how can i re-order this serie according to the size of x_t-1
>
> The procedure Sort it seems it does not work well.
> anyone has suggestions?
> thanks
>
> P.
>
>
>
> ____________________________________________________________
> Libero ADSL: navighi gratis a 1.2 Mega, senza canone e costi di attivazione.
> Abbonati subito su http://www.libero.it
>
>
Have a look at the documentation ("Sort"):

In[1]:=
data = Array[{#, Random[]} &, {10}]
Out[1]=
{{1, 0.380212}, {2, 0.426241}, {3, 0.669725}, {4, 0.383463},
{5, 0.113896}, {6, 0.315838}, {7, 0.660724}, {8, 0.641325},
{9, 0.902577},{10, 0.891397}}
In[2]:=
Sort[data, (Less @@ Last /@ {#1, #2}) &]
Out[2]=
{{5, 0.113896}, {6, 0.315838}, {1, 0.380212}, {4, 0.383463},
{2, 0.426241}, {8, 0.641325}, {7, 0.660724}, {3, 0.669725},
{10, 0.891397}, {9, 0.902577}}

--
Peter Pein
10245 Berlin

```

• Prev by Date: Re: sort procedure
• Next by Date: Re: sort procedure
• Previous by thread: Re: sort procedure
• Next by thread: Re: sort procedure