[R] why there is no quarters?

Duncan Murdoch murdoch.duncan at gmail.com
Sun Dec 15 13:11:25 CET 2013


On 13-12-15 6:43 AM, 水静流深 wrote:
> seq(as.Date("2001/1/1"),as.Date("2010/1/1"),"years")
> seq(as.Date("2001/1/1"),as.Date("2010/1/1"),"weeks")
> seq(as.Date("2001/1/1"),as.Date("2010/1/1"),"days")
>
> why there is no
> seq(as.Date("2001/1/1"),as.Date("2010/1/1"),"quarters")  ?

There's no need for it.  Just use months, and take every 3rd one:
	
x <- seq(as.Date("2001/1/1"),as.Date("2010/1/1"),"months")
x[seq_along(x) %% 3 == 1]



More information about the R-help mailing list