Description Usage Arguments Value Examples
Convert a vector to date. By default, returns vector unchanged if new NAs would be created. You can send non-dates in loops (or otherwise) and they won't be affected. Can be useful for checking if something is a date.
1 2 3 4 |
x |
Vector to convert. |
do.time |
Allow processing to time values. |
do.excel |
Allow conversion of excel date integers. |
already.clean.vector |
Sometimes in multi-step data operations clean.vector will have already been called. |
verbose |
Print useful information via cat. |
do.na |
What to do in case new NAs are created during conversion. If all NAs, the vector will be returned unchanged. Otherwise, this argument determines behavior: return-unchnaged returns the vector unchanged. warning returns new NAs with a warning. stop throws an error. return-na prints a message with cat which can be turned off with verbose = FALSE. |
min.acceptable.date |
Set to NULL to ignore. Sometimes numbers are assumed to be excel-formatted. One way to prevent this is to set min/max acceptable dates to help the conversion know if something is a meaningful data or not. |
max.acceptable.date |
Set to NULL to ignore. Sometimes numbers are assumed to be excel-formatted. One way to prevent this is to set min/max acceptable dates to help the conversion know if something is a meaningful data or not. |
Processed vector.
1 2 3 4 5 | todate( c( '12/3/14', 'Hello'), do.na = 'return-na' )
todate( c( '12/3/14', 'Hello') )
todate( c( "2018-10-20", "2018-10-20", "2018-10-20", "2018-10-20" ), verbose = FALSE )
todate( c( "6/12/2015 20:45:00", "4/4/2015 22:20:00" , "4/11/2016 23:24:00", "9/29/2016 1:10:00" ), do.time = TRUE )
todate( 43393.5138888889, do.time = TRUE ) # this is 2018-10-20 12:20:00 in Excel.
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.