Jeremie,

As months have irregular number of dates, one needs to use a function that
accounts for that (date libraries and packages have that, one of the earliest
for R was my RcppBDT package using Boost Date_Time), or be otherwise clever.

Here is a one-liner using the latter approach:

   seq(as.Date("2010-02-01"), length=24, by="1 month") - 1

See this old StackOverflow answer where I used this before:

   
https://stackoverflow.com/questions/8333838/generate-a-sequence-of-the-last-day-of-the-month-over-two-years

Dirk

-- 
https://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to