Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error in using %m+% when NA involved and rollback required #463

zhangkd5 opened this issue Aug 30, 2016 · 1 comment

error in using %m+% when NA involved and rollback required #463

zhangkd5 opened this issue Aug 30, 2016 · 1 comment


Copy link

@zhangkd5 zhangkd5 commented Aug 30, 2016

When using %m+% function to add months to a date-time vector I noticed in a special situation where the date-time object includes both NA and month-end dates that require rollback, an error will occur:

> ymd(c('20150131')) %m+% months(1)  # OK when no NA
[1] "2015-02-28"
> ymd(c('2015-01-31', NA)) %m+% months(2)  # OK when no rollback
[1] "2015-03-31" NA  
> ymd(c('20150131', NA)) %m+% months(1) # Error when combining the two
Error in NextMethod(.Generic) : 
  NAs are not allowed in subscripted assignments

> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

other attached packages:
[1] lubridate_1.5.6

loaded via a namespace (and not attached):
[1] magrittr_1.5  tools_3.3.1   stringi_1.1.1 stringr_1.0.0
@vspinu vspinu added the bug label Aug 31, 2016
Copy link

@vspinu vspinu commented Aug 31, 2016

Thanks. I will address it asap.

@vspinu vspinu closed this in 27bb584 Sep 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants