The following R code is not working properly:
seq(as.Date("2016/3/31"),as.Date("2016/6/30"),by = "month")
The output is:
"2016-03-31" "2016-05-01" "2016-05-31"
But the expected output is:
"2016-03-31" "2016-04-30" "2016-05-31""2016-06-30"
The following R code is not working properly:
seq(as.Date("2016/3/31"),as.Date("2016/6/30"),by = "month")
The output is:
"2016-03-31" "2016-05-01" "2016-05-31"
But the expected output is:
"2016-03-31" "2016-04-30" "2016-05-31""2016-06-30"
I think this is a duplicate of Generate a sequence of the last day of the month over two years and they suggested to do the following
ymd("2010-02-01")+ months(0:23)-days(1)
Simply specify the first day of the next month and generate a sequence from that but subtract 1 days from it to get the last day of the preceding month.