recogniseDateTime: Recognise date-time variables when month and year are known...

Description Usage Arguments Details Value Author(s) Examples

View source: R/FormatDate.R

Description

Recognise date-time variables when month and year are known (otherwise there is no way to differentiate date and month)

Usage

1
recogniseDateTime(dateTime, month, year, time_dummy = "11:11:11")

Arguments

dateTime

A vector of strings indicating the date and time that satisfy the assumptions specified in the Details section.

month

A number (1 to 12) indicating the month this time point is in.

year

A number (with 4 digits) indicating the year this time point is in.

time_dummy

A dummy time assigned to date-time variables when time is not available. Default is 11:11:11.

Details

Assumptions made on the format of input time are: (i) only "/" or "-" is used to separate date, month and year, and no mixture of the two symbols in a single time variable; (ii) only ":" is used to separate hour, minute and second, and the order is always in "h:m:s" (second can be missing, but not minute or hour); and (iii) a dateTime variable should contain both date and time.

Value

Returns a string vector of the format

Author(s)

Yilin Ning, Ying Chen

Examples

1
2
3
recogniseDateTime(dateTime = c("02/04/20 1:23", "19/02/20 3:12 PM",
                               "11/02/2020 12:11:13", "02/04/2020"),
                  month = 2, year = 2020)

nyilin/QcDM documentation built on June 29, 2021, 1:14 a.m.