我有一些像
这样的数据Date col A col B col C .......
01/31/2008 00:00:00.000
01/31/2009 00:00:00.000
01/31/2010 00:00:00.000 bunch of data
01/31/2011 00:00:00.000
01/31/2012 00:00:00.000
01/31/2013 00:00:00.000
02/28/2008 00:00:00.000
02/28/2009 00:00:00.000 in these columns
02/28/2010 00:00:00.000
02/28/2011 00:00:00.000
02/28/2012 00:00:00.000
02/28/2011 00:00:00.000
03/31/2008 00:00:00.000
03/31/2009 00:00:00.000
03/31/2010 00:00:00.000
03/31/2011 00:00:00.000
03/31/2012 00:00:00.000
03/31/2013 00:00:00.000
.
.
.
我需要重新排列它们以使其看起来像
Date col A col B col C .......
01/31/2008 00:00:00.000
02/28/2008 00:00:00.000
03/31/2008 00:00:00.000 corresponding data
04/30/2008 00:00:00.000
05/31/2008 00:00:00.000
.
.
.
即现在它的月末,我只是按顺序需要它们任何想法如何做到这一点,你可以假设每个日期有6个,从1月到12月有12个日期。感谢。
答案 0 :(得分:1)
这可能会有所帮助:
df <- df[with(df,order(Date)),]