guessDateFormat: Determine Format of Date and Date-Time Variables

Description Usage Arguments Details Value Author(s) Examples

View source: R/parse_dates.R

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

1

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

1
2
x <- c("2014-01-15", "20140202")
guessDateFormat(x)

couthcommander/pkdata documentation built on Sept. 11, 2021, 10:22 p.m.