使用日期字符串对xts yearmon对象进行子集化时,我没有得到我要求的日期。返回的行向前偏移一个月。为什么?谢谢!
# create a two year series of monthly data
asyearmon<-as.xts(1:24,as.yearmon('2012-01')+(0:23)/12)
asyearmon['201206',]
#asking for June returns July
# [,1]
#Jul 2012 7
asyearmon['201206/201212',]
#asking for the rest of 2012 includes Jan 2013
# [,1]
#Jul 2012 7
#Aug 2012 8
#Sep 2012 9
#Oct 2012 10
#Nov 2012 11
#Dec 2012 12
#Jan 2013 13