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") ? [[alternative HTML version deleted]]
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]
Hi, I also would like to use quarters. I think a work around would be to just label each record in the dataframe by its quarter. i.e. you add a factor called 'Quarter' with four levels (Q1 to Q4) for each row and you assign the level based on the month of the date. You can easily do this with as.Date and as.character. Pancho Mulongeni Research Assistant PharmAccess Foundation 1 Fouch? Street Windhoek West Windhoek Namibia ? Tel:?? +264 61 419 000 Fax:? +264 61 419 001/2 Mob: +264 81 4456 286