I want to get the date sequence between a startDate
and endDate
by adding 1 month to the startDate
. ie, if startDate
is 2013-01-31 and endDate
is 2013-07-31, I would prefer to see dates like this:
"2013-01-31" "2013-02-28" "2013-03-31" "2013-04-30" "2013-05-31" "2013-06-30" "2013-07-31"
I have tried seq.Date(as.Date("2013-01-31"),by="month",length.out=7)
.
But the output of this code is like this
> seq.Date(as.Date("2013-01-31"),by="month",length.out=7)
[1] "2013-01-31" "2013-03-03" "2013-03-31" "2013-05-01" "2013-05-31" "2013-07-01" "2013-07-31"
So,what is the simplest solution to get the correct output?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…