Search code examples
ranytime

is this a bug in anytime's anydate function?


I'm trying to convert a vector of dates and this is the minimal reproducible example.

dates <- c("04-Nov-2013", "20-Jan-2014", "28-Jan-2014", "24-Apr-2014")
library(anytime)
anydate(dates)

My output is:

[1] "2013-11-04"  NA  NA  "2014-04-24" 

which is incorrect for the middle two elements. Is this a bug? My version of anytime package is 0.1.1

sessionInfo() as requested:

sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 7 (build 7601) Service Pack 1

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   base     

other attached packages:
[1] anytime_0.1.1   lazyeval_0.2.0  magrittr_1.5    lubridate_1.6.0
[5] readr_1.0.0     stringr_1.1.0   dplyr_0.5.0     tidyr_0.6.0    

loaded via a namespace (and not attached):
[1] R6_2.2.0       assertthat_0.1 DBI_0.5-1      tools_3.3.2    tibble_1.2    
[6] Rcpp_0.12.8    stringi_1.1.2 

Solution

  • I cannot replicate that:

    R> dates <- c("04-Nov-2013", "20-Jan-2014", "28-Jan-2014", "24-Apr-2014")
    R> anydate(dates)
    [1] "2013-11-04" "2014-01-20" "2014-01-28" "2014-04-24"
    R> 
    

    We did have one weird recent bug on Windows64 with this %b format. What platform are you on?

    That discussion is in this issue ticket on GitHub and make sure you follow to the end. I did change some code, so you may need that update -- which should go into a new version "Real Soon Now". But as far as I know the bug only bites in Windows 64 bit, and not even Windows 32 bit.