library(lubridate)
a <- c("2013-1-1", "2013-0-1")
b <- "2013-0-1"
ymd(a)
[1] "2013-01-01 UTC" "2013-01-01 UTC"
ymd(b)
Warning: All formats failed to parse. No formats found.
[1] NA
sessionInfo()
R version 3.0.3 (2014-03-06)
Platform: i386-w64-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=English_New Zealand.1252
[2] LC_CTYPE=English_New Zealand.1252
[3] LC_MONETARY=English_New Zealand.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_New Zealand.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] lubridate_1.3.3 knitr_1.5
loaded via a namespace (and not attached):
[1] digest_0.6.4 evaluate_0.5.3 formatR_0.10 memoise_0.1
[5] plyr_1.8.1 Rcpp_0
library(lubridate)
a <- c("2013-1-1", "2013-0-1")
b <- "2013-0-1"
ymd(a)
[1] "2013-01-01 UTC" "2013-01-01 UTC"
ymd(b)
Warning: All formats failed to parse. No formats found.
[1] NA
sessionInfo()
R version 3.0.3 (2014-03-06)
Platform: i386-w64-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=English_New Zealand.1252
[2] LC_CTYPE=English_New Zealand.1252
[3] LC_MONETARY=English_New Zealand.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_New Zealand.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] lubridate_1.3.3 knitr_1.5
loaded via a namespace (and not attached):
[1] digest_0.6.4 evaluate_0.5.3 formatR_0.10 memoise_0.1
[5] plyr_1.8.1 Rcpp_0