On 8/4/2006 4:18 AM, Martin Maechler wrote: >>>>>> "Gabor" == Gabor Grothendieck <[EMAIL PROTECTED]> >>>>>> on Thu, 3 Aug 2006 20:14:24 -0400 writes: > > Gabor> That's, in fact, the way seq.dates works in the chron package: > Gabor> library(chron) > Gabor> x <- chron("01/31/2006") > Gabor> seq(x, by = "month", length = 2) # 01/31/06 02/28/06 > > Hmm, so, by "logic", > 2006-01-31 + 1month |-> 2006-02-28 > 2006-01-30 + 1month |-> 2006-02-27 (?) > 2006-01-29 + 1month |-> 2006-02-26 (?) > 2006-01-28 + 1month |-> 2006-02-25 ???????? > > I really don't like 'chron's behavior which seems much less > logical to me than what R does with the official "Date" objects : > >> options(width=88) >> for(d in 28:31) print(seq(as.Date(paste("2006-01", d, sep="-")), len = 6, >> by="1 month")) > [1] "2006-01-28" "2006-02-28" "2006-03-28" "2006-04-28" "2006-05-28" > "2006-06-28" > [1] "2006-01-29" "2006-03-01" "2006-03-29" "2006-04-29" "2006-05-29" > "2006-06-29" > [1] "2006-01-30" "2006-03-02" "2006-03-30" "2006-04-30" "2006-05-30" > "2006-06-30" > [1] "2006-01-31" "2006-03-03" "2006-03-31" "2006-05-01" "2006-05-31" > "2006-07-01" > > {which, BTW, *is* reproducible code; the bug report was only > reproducible on the day it was posted because it sillily used > Sys.date()}
I think the obvious solution here is to ask R Core to move the earth slightly closer to the sun, so the year is exactly 360 days long, and these problems don't arise. Or perhaps exactly 372 days would be better; that would be further from the sun and would also help with global warming. Duncan Murdoch > > Gabor> See the help desk article in R News 4/1 for more about the main > Gabor> date classes. > > Gabor> On 8/3/06, Ponzio, Stephen [CIB-LAVA] <[EMAIL PROTECTED]> wrote: > >> You're right, it's tricky. > >> > >> I guess I would expect Jan. 30 + 1 month = Feb. 28. > >> > >> Of couse, then Jan. 30 + 1 month = Jan. 28 + 1 month; > >> I understand. > >> > >> Being that "1 month" is imprecise in terms of number of days, > >> this anomaly is preferable to skipping months (Jan. 30 + 1 month = > March 2), > >> in my opinion. > >> > >> That is what I expected, anyway. > >> > >> Thanks, > >> Stephen > > [.........] > > ______________________________________________ > 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