Utilizes the EPOCH method from the SDTM spec: Missing when --DTC
is blank;
equal to 'SCREENING'
if --DTC
if before RFXSTDTC
; equal to 'TREATMENT'
if --DTC
is on or after RFXSTDTC
and on or before RFXENDTC
; equal to
'FOLLOW-UP'
if --DTC
is after RFXENDTC
.
Arguments
- tbl
a data frame with date class columns
RFXSTDTC
andRFXENDTC
and the column given in thedate_col
argument- date_col
a string, the column name of the event date used to determine the EPOCH; this column can either have a date class or a character class in the YYYY-MM-DD format
- RFXSTDTC
a string, the date column to use for
RFXSTDTC
, default is"RFXSTDTC"
; this column can either have a date class or a character class in the YYYY-MM-DD format- RFXENDTC
a string, the date column to use for
RFXENDTC
, default is"RFXENDTC"
; this column can either have a date class or a character class in the YYYY-MM-DD format
Examples
df <- data.frame(
DTC = c("2023-08-01", "2023-08-02", "2023-08-03", "2023-08-04"),
RFXSTDTC = rep("2023-08-02", 4),
RFXENDTC = rep("2023-08-03", 4)
)
create_EPOCH(df, date_col = "DTC")
#> DTC RFXSTDTC RFXENDTC EPOCH
#> 1 2023-08-01 2023-08-02 2023-08-03 SCREENING
#> 2 2023-08-02 2023-08-02 2023-08-03 TREATMENT
#> 3 2023-08-03 2023-08-02 2023-08-03 TREATMENT
#> 4 2023-08-04 2023-08-02 2023-08-03 FOLLOW-UP