yes it is the expected behaviour is you check the documentation: Using "month" first advances the month without changing the day: if this results in an invalid day of the month, it is counted forward into the next month: see the examples.
Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Thu, Jan 7, 2021 at 11:20 AM Jeremie Juste <jeremieju...@gmail.com> wrote: > > Hello, > > I recently bumped into a behavior that surprised me. > When performing the following command, I would expect the second > argument to be "2012-09-30" but got "2012-10-01" instead > > seq(as.Date("2012-08-31"),by="1 month",length=2) > [1] "2012-08-31" "2012-10-01" > > When the same command is performed for the start of the month. I get a > result I expect. > > seq(as.Date("2012-08-01"),by="1 month",length=2) > [1] "2012-08-01" > > > Is there an explanation for this behavior? > > Best regards, > -- > Jeremie Juste > > ______________________________________________ > 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. ______________________________________________ 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.