| create_EPOCH {sdtmval} | R Documentation |
Create the EPOCH variable
Description
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.
Usage
create_EPOCH(tbl, date_col, RFXSTDTC = "RFXSTDTC", RFXENDTC = "RFXENDTC")
Arguments
tbl |
a data frame with date class columns |
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 |
RFXENDTC |
a string, the date column to use for |
Value
a modified copy of tbl with the EPOCH column
See Also
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")