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

Closed
zhangkd5 opened this Issue Aug 30, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@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)

locale:
[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

@vspinu

This comment has been minimized.

Show comment
Hide comment
@vspinu

vspinu Aug 31, 2016

Member

Thanks. I will address it asap.

Member

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