Definitely not a bug. You seem to expect seq.Date to have an entirely different convention depending on whether you are at the beginning of the month or at the end of the month, which does not seem reasonable to me.
For instance, does adding a month to Feb 28th give March 28th or March 31st? Given the choices, counting from the beginning of the month seems much more reasonable. I don't want Feb 1st plus a month to be March 4th! So if our (extremely reasonable) convention is to count from the beginning of the month, that is, Feb 28th + 1 month becomes March 28th, then one would expect August 31 + 1 month to be September 31st. But since this is not a valid date, seq.Date naturally returns October 1st (per your example). To do a sequence along month ends, write a sequence along the beginning of the month, then subtract 1 day. For instance: > seq.Date(as.Date("2004-12-31") + 1, as.Date("2005-12-31") + 1, by = "month") - 1 Alternatively, you should write your own sequence function that defines month sequences differently for the beginning of the month versus the end or middle of the month, or in any other way you want (fixed days, trading days, lunar calendar, etc.). HTH, Robert -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Thursday, August 03, 2006 10:27 AM To: r-devel@stat.math.ethz.ch Cc: [EMAIL PROTECTED] Subject: [Rd] seq improperly increments dates (PR#9120) Full_Name: Stephen Ponzio Version: 2.3.1 OS: Windows Submission from: (NULL) (199.67.138.42) With the option by="1 month" and a date that is the 31st, the function seq doesn't give the last day of successive months, as I would expect it should: > Sys.Date() [1] "2006-08-03" > Sys.Date()-3 [1] "2006-07-31" # WORKS OK on Aug. 1: > seq(Sys.Date()-2, len=5, by="1 month") [1] "2006-08-01" "2006-09-01" "2006-10-01" "2006-11-01" "2006-12-01" # DOESN'T WORK on July 31 (list has no date in Sept): > seq(Sys.Date()-3, len=5, by="1 month") [1] "2006-07-31" "2006-08-31" "2006-10-01" "2006-10-31" "2006-12-01" ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel