0

I want sequence of dates by months, so I tried seq() command in R and what I got is

> seq(as.Date("2016-10-31"), length=3, by="1 month") 
[1] "2016-10-31" "2016-12-01" "2016-12-31"

any other solution ?

zx8754
  • 42,109
  • 10
  • 93
  • 154
  • 4
    What is your expected output? If it is the last day of each month , you can check [here](http://stackoverflow.com/questions/8333838/how-do-you-generate-a-sequence-of-the-last-day-of-the-month-over-two-years-in-r) – akrun Oct 05 '16 at 07:00
  • expected output is "2016-10-31" "2016-11-30" "2016-12-31" – Ajay Jadhav Oct 05 '16 at 07:40
  • That function has that bug but you can do the same by > seq.Date((as.Date("2016-10-31")+1),(as.Date("2016-12-31")+1),by="1 months") - 1 [1] "2016-10-31" "2016-11-30" "2016-12-31" – Ajay Jadhav Apr 06 '17 at 11:52

0 Answers0