[R] zoo package; a question on as.yearmon and as.yearqtr
Gabor Grothendieck
ggrothendieck at gmail.com
Fri May 4 10:07:35 CEST 2012
On Fri, May 4, 2012 at 2:47 AM, jpm miao <miaojpm at gmail.com> wrote:
> Hello,
>
> In zoo package, if I would like the time frame to be 1981M01 to 1982M12,
> then I code
>
> time_0<-as.yearmon("1981-01")+(0:23)/12
>
>
> However, if the time frame of interest becomes 1981M01 to 2011M12, it is
> relatively hard to calculate the number of months. Is there any faster way
> to do it? Thanks,
Try seq:
seq(as.yearmon("1981-01"), as.yearmon("2011-12"), 1/12)
--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com
More information about the R-help
mailing list