从月末到时间顺序重塑日期 [英] reshaped date from month end to chronological
本文介绍了从月末到时间顺序重塑日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一些数据,如
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
.
.
.
我需要重新排列,以使其看起来像
I need them rearranged so that it looks likes
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个,从jan到dec的12个日期。谢谢。
ie right now its month end, I just need them in sequential order any idea how to do this, you can assume there are 6 per date and 12 dates from jan to dec. Thanks.
推荐答案
这可能有助于:
df <- df[with(df,order(Date)),]
这篇关于从月末到时间顺序重塑日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文