[R] sort data.frame by specific date column

Mark Knecht markknecht at gmail.com
Sat Jul 11 04:30:46 CEST 2009


I have a data.frame that was built from a number of smaller
data.frames with rbind. Each ssmaller data.frame bound together runs
over the same date ranges. The format of the whole thing looks like
this:

     Trade PosType  EnDate EnTime  ExDate ExTime PL_Pos
1        1       1 1040107    915 1040107   1300    164
2        2       1 1040108    909 1040108   1300    184
3        3       1 1040115    921 1040115   1300     64
4        4       1 1040120   1134 1040120   1300    124
5        5       1 1040121    923 1040121   1300     84
6        6       1 1040205   1043 1040205   1300   -196

I would like to sort the new data.frame using column 3, EnDate from
lowest to highest. How do I do this?

The help file example section for ?sort doesn't seem to have any
examples of doing this by column so I'm wondering if this is the done
with some other command I haven't discovered, or am I just missing the
obvious at 7:30PM on a Friday night?

Thanks,
Mark




More information about the R-help mailing list