[R] Sort a dataframe on the column Date

Mark Knecht
2009-07-28T13:01:50Z

On Mon, Jul 27, 2009 at 11:46 PM, Meenu Sahi<meenusahi at gmail.com>
wrote:
> Dear Users
> I have a dataframe called mydata4 of the following order with the first
> column as a date and the rest of the columns are numeric with rate.
> Column 1 ? ? ? ? ?Rate1 : Rate 20
> (PxMid)
> 01/01/2003
> 07/01/2001
> ----
> ----
> --
>
> I wish to sort this dataframe on the first col in ascending order.
> I tried to do the following
> mydata4<-mydata4[,order(mydata4$PxMid)]
> This give an error.
>
> Please help.
>
> Regards
> Meenu

Try

mydata4<-mydata4[order(mydata4$PxMid), ]

Cheers,
Mark