Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
ymd(my_vector) silently parses "2013-0-1" as part of my_vector #236
a <- c("2013-1-1", "2013-0-1")
 "2013-01-01 UTC" "2013-01-01 UTC"
Warning: All formats failed to parse. No formats found.
R version 3.0.3 (2014-03-06)
Platform: i386-w64-mingw32/i386 (32-bit)
 LC_COLLATE=English_New Zealand.1252
 LC_CTYPE=English_New Zealand.1252
 LC_MONETARY=English_New Zealand.1252
 LC_TIME=English_New Zealand.1252
attached base packages:
 stats graphics grDevices utils datasets methods base
other attached packages:
 lubridate_1.3.3 knitr_1.5
loaded via a namespace (and not attached):
 digest_0.6.4 evaluate_0.5.3 formatR_0.10 memoise_0.1
 plyr_1.8.1 Rcpp_0
"2013-0-1" is not a date, is it? Where did you get it from?
It works by accident because the underlying C parser is a bit relaxed about the 0s in a couple of places. The format detection is rigorous, though, and this is why your
So your point is to make the parser fail on
Correct, "2013-0-1" is not a date, and I would expect the parser to fail on it. I got it by doing
Thanks for all the