Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upadd_period_to_date/add_months returns NA for some dates/periods #633
Comments
mwmclean
commented
Feb 5, 2018
•
|
I am fixing With the github version you should see: > int %% months(1)
[1] 2017-02-28 12:00:00 CET--2017-03-25 CET
[2] 2014-02-28 12:00:00 CET--2014-03-16 CET
[3] 2012-11-30 12:00:00 CET--2012-12-15 CET
[4] 2011-02-28 12:00:00 CET--2011-03-25 CET
[5] 2015-09-30 12:00:00 CEST--2015-10-16 CEST
[6] 2016-02-29 12:00:00 CET--2016-03-16 CET
[7] 2014-02-28 12:00:00 CET--2014-03-28 CET
[8] 2015-06-30 12:00:00 CEST--2015-07-22 CEST
> mt + months(id)
[1] NA NA NA NA NA NA NA NA
> mt %m+% months(id)
[1] "2017-02-28 12:00:00 UTC" "2014-02-28 12:00:00 UTC"
[3] "2012-11-30 12:00:00 UTC" "2011-02-28 12:00:00 UTC"
[5] "2015-09-30 12:00:00 UTC" "2016-02-29 12:00:00 UTC"
[7] "2014-02-28 12:00:00 UTC" "2015-06-30 12:00:00 UTC"
> add_with_rollback(mt, months(id))
[1] "2017-02-28 12:00:00 UTC" "2014-02-28 12:00:00 UTC"
[3] "2012-11-30 12:00:00 UTC" "2011-02-28 12:00:00 UTC"
[5] "2015-09-30 12:00:00 UTC" "2016-02-29 12:00:00 UTC"
[7] "2014-02-28 12:00:00 UTC" "2015-06-30 12:00:00 UTC"
> add_with_rollback(mt, months(id), T, F)
[1] "2017-03-01 UTC" "2014-03-01 UTC" "2012-12-01 UTC" "2011-03-01 UTC"
[5] "2015-10-01 UTC" "2016-03-01 UTC" "2014-03-01 UTC" "2015-07-01 UTC" |