chr_to_dttm: Parse Dates in Character Format to Datetime Format

View source: R/std_date.R

chr_to_dttmR Documentation

Parse Dates in Character Format to Datetime Format

Description

chr_to_dttm standardizes a datetime vector in character format and returns a vector in POSIXct format.

Usage

chr_to_dttm(
  x,
  tz = "UTC",
  orders = c("mdy", "dmy", "ymd", "mdyT", "dmyT", "ymdT", "mdyR", "dmyR", "ymdR",
    "mdyr", "dmyr", "ymdr", "mdyTz", "dmyTz", "ymdTz", "Tmdyz", "Tdmyz", "Tymdz",
    "mdyRz", "dmyRz", "ymdRz", "mdyrz", "dmyrz", "ymdrz", "Tmdy", "Tdmy", "Tymd",
    "Tmdyz", "Tdmyz", "Tymdz"),
  train = TRUE,
  ...
)

Arguments

x

A vector of character dates

tz

Optional timezone

orders

The orders to use when parsing character vector with parse_date_time()

train

logical, default TRUE. Whether to train formats on a subset of the input vector. The result of this is that supplied orders are sorted according to performance on this training set, which commonly results in increased performance. Please note that even when train = FALSE (and exact = FALSE) guessing of the actual formats is still performed on a pseudo-random subset of the original input vector. This might result in All formats failed to parse error. See notes below.

...

Additional arguments to pass to parse_date_time()

Value

A POSIXct vector


jesse-smith/coviData documentation built on Jan. 14, 2023, 11:08 a.m.