Guess if a character vector contains Date values, and convert them to date
Source:R/date_standardization_helpers.R
date_guess_convert.Rd
Guess if a character vector contains Date values, and convert them to date
Arguments
- data
A data frame
- error_tolerance
A number between 0 and 1 indicating the proportion of entries which cannot be identified as dates to be tolerated; if this proportion is exceeded, the original vector is returned, and a message is issued; defaults to 0.4 (40 percent).
- timeframe
A vector of 2 values of type date. If provided, date values that do not fall within this timeframe will be set to
NA
.- orders
The date codes for fine-grained parsing of dates. This allows for parsing of mixed dates. If a list is supplied, that list will be used for successive tries in parsing. Default orders are:
- modern_excel
When parsing dates from excel, some dates are stored as integers. Modern versions of Excel represent dates as the number of days since 1900-01-01, but pre-2011 Excel for OSX have the origin set at 1904-01-01. If this parameter is
TRUE
(default), then this assumes that all numeric values represent dates from either a Windows version of Excel or a 2011 or later version of Excel for OSX. Set this parameter toFALSE
if the data came from an OSX version of Excel before 2011.