compute_tmf: Derive the Time Imputation Flag

View source: R/derive_vars_dtm.R

compute_tmfR Documentation

Derive the Time Imputation Flag

Description

Derive the time imputation flag (⁠*TMF⁠) comparing a date character vector (--DTC) with a Datetime vector (⁠*DTM⁠).

Usage

compute_tmf(dtc, dtm, ignore_seconds_flag = TRUE)

Arguments

dtc

The date character vector (--DTC).

A character date is expected in a format like yyyy-mm-ddThh:mm:ss (partial or complete).

dtm

The Date vector to compare (⁠*DTM⁠).

A datetime object is expected.

ignore_seconds_flag

ADaM IG states that given SDTM (--DTC) variable, if only hours and minutes are ever collected, and seconds are imputed in (⁠*DTM⁠) as 00, then it is not necessary to set (⁠*TMF⁠) to "S".

By default it is assumed that no seconds are collected and ⁠*TMF⁠ shouldn't be set to "S". A user can set this to FALSE if seconds are collected.

The default value of ignore_seconds_flag is set to TRUE in admiral 1.4.0 and later.

Details

Usually this computation function can not be used with ⁠%>%⁠.

Value

The time imputation flag (⁠*TMF⁠) (character value of "H", "M" , "S" or NA)

See Also

Date/Time Computation Functions that returns a vector: compute_age_years(), compute_dtf(), compute_duration(), convert_date_to_dtm(), convert_dtc_to_dt(), convert_dtc_to_dtm(), convert_xxtpt_to_hours(), impute_dtc_dt(), impute_dtc_dtm()

Examples

library(lubridate)

compute_tmf(dtc = "2019-07-18T15:25", dtm = ymd_hm("2019-07-18T15:25"))
compute_tmf(dtc = "2019-07-18T15", dtm = ymd_hm("2019-07-18T15:25"))
compute_tmf(dtc = "2019-07-18", dtm = ymd("2019-07-18"))
compute_tmf(dtc = "2022-05--T00:00", dtm = ymd_hm("2022-05-15T23:59"))
compute_tmf(dtc = "2022-05--T23:00", dtm = ymd_hm("2022-05-15T23:59"))
compute_tmf(
  dtc = "2022-05--T23:59:00",
  dtm = ymd_hms("2022-05-15T23:59:59"),
  ignore_seconds_flag = FALSE
)


admiral documentation built on May 28, 2026, 9:08 a.m.