guessDateFormat {pkdata} | R Documentation |
Determine Format of Date and Date-Time Variables
Description
Given a vector of dates or date-times, determine the format if one is used
consistently. If inconsistentencies are found, the function will fail.
See strptime
for examples of format specifications.
Usage
guessDateFormat(x)
Arguments
x |
character vector of dates or date-times |
Details
guessDateFormat
is rigid when determining the date format. For
date-times it expects the date and time parts to be separated by a space. It
does not recognize all format specifications, such as the AM/PM indicator.
The time part should have at least one colon to separate hours from minutes.
The date part may have any separator as non-numerical values are removed
before parsing.
Value
Returns a character string representing the format of the date-time variables.
Author(s)
Cole Beck
Examples
x <- c("2014-01-15", "20140202")
guessDateFormat(x)
[Package pkdata version 0.1.0 Index]