Description Usage Arguments Value Author(s) See Also Examples
Attempts to convert input vector to Date, if that fails tries to convert to
double. If conversion induces NA
the function returns NULL
indicating a failure.
1 |
x |
character vector to convert to dates |
a vector of dates, or of doubles or NULL
.
Johan Lindstrom
Other utility functions: defaultList
1 2 3 4 5 6 7 8 9 10 11 12 13 | ##a vector of dates is returned as is
convertCharToDate( seq(as.Date("2012-01-01"),as.Date("2012-01-31"),by=5) )
##if given as chracter vectors Date is returned
convertCharToDate( c("2012-01-01","2012-01-05","2012-01-10","2012-01-12") )
##double is returned as is
convertCharToDate( rnorm(5) )
##other things result in NULL
convertCharToDate( c("a","b","c") )
convertCharToDate( c("2012-01-01", "2012-01-05", "a", "2012-01-12") )
convertCharToDate( c(1,2,3,"d") )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.