Skip to contents

Convert the character representation of the date in an original SDTM dataset to a POSIXct object.

Usage

sdtm_dtc_to_datetime(x, ...)

# S3 method for class 'list'
sdtm_dtc_to_datetime(x, ...)

# S3 method for class 'Date'
sdtm_dtc_to_datetime(x, ...)

# S3 method for class 'POSIXt'
sdtm_dtc_to_datetime(x, ...)

# S3 method for class 'character'
sdtm_dtc_to_datetime(x, truncated = 5, ...)

# S3 method for class 'data.frame'
sdtm_dtc_to_datetime(x, date_col_pattern = "DTC$", ...)

Arguments

x

The data to convert

...

Additional arguments passed to `lubridate::ymd_hms()` or `lubridate::ymd()`

truncated

Passed to `lubridate::ymd_hms()` or `lubridate::ymd()`; the `truncated` argument is always considered relative to `ymd_hms` formatting, so it is used as `truncated - 3` for dates.

date_col_pattern

A regex to search column names for dates to convert.

Value

The data with the date converted. Note that all dates will be returned as POSIXct objects, so partial dates will appear as the