Skip to contents

Generate actual times from dates and times

Usage

sdtm_time_actual(x, ...)

# S3 method for list
sdtm_time_actual(x, ...)

# S3 method for data.frame
sdtm_time_actual(
  x,
  ref_col = "DTC_first_dose",
  dtc_col_pattern = "DTC$",
  units = "hours",
  tz = NULL,
  ...
)

Arguments

x

An SDTM data set

...

Passed to methods.

ref_col

The character name of the column to use as a reference time point.

dtc_col_pattern

The regex to use to select columns to use for actual time generation. The regex will also be used to modify the name.

units

The units to report the actual time in (passed to as.numeric).

tz

The time zone for difftime (default is used if is.null(tz)).

Value

x with new columns matching dtc_col_pattern named

gsub(pattern=dtc_col_pattern, replacement=paste0("actual_", units), names(x)) The new columns will have the actual time in numerical values matching the units.