I am trying to order a series of time data I have stored in a data frame. The format is of:
"%Y-%b"
Which looks like "2009-Sep"
etc.
Until now I have managed to find this method:
ds[order(as.Date(ds$yearmonth, format = "%Y-%b")),]
But it only sort by year, and then it moves to alphabetical order regarding the months, giving me an order of 2009-Jan
, 2009-Jul
, 2009-Jun
etc. I am quite puzzled this is not an easy problem to fix.
Please help...
Best Kasper
See Question&Answers more detail:os