R/check_ss_ssdtc_alive_dm.R
check_ss_ssdtc_alive_dm.Rd
This check looks for non-missing SS.SSDTC when SS.SSORRES contains 'ALIVE' and Subject Status Date/Time of Assessments is greater then Start Date/Time of Disposition Event(SS.SSDTC > DS.DSSTDTC)
check_ss_ssdtc_alive_dm(SS, DM)
Subject Status SDTM dataset with variables USUBJID, SSDTC, SSORRES, SSTESTCD, VISIT
Demographics SDTM dataset with variables USUBJID, DTHDTC
boolean value if check failed or passed with 'msg' attribute if the test failed
SS <- data.frame(
USUBJID = 1:5,
SSDTC = "2020-01-02",
SSTESTCD = "SURVSTAT",
SSORRES = c("DEAD","DEAD","ALIVE","DEAD","ALIVE"),
VISIT = "WEEK 4"
)
DM <- data.frame(
USUBJID = 1:5,
DTHDTC = "2020-01-03"
)
check_ss_ssdtc_alive_dm(SS, DM)
#> [1] TRUE
SS <- data.frame(
USUBJID = 1:5,
SSDTC = "2020-01-04",
SSTESTCD = "SURVSTAT",
SSORRES = c("DEAD","DEAD","ALIVE","DEAD","ALIVE"),
VISIT = "WEEK 4"
)
DM <- data.frame(
USUBJID = 1:5,
DTHDTC = c("2020-01-04", "2020-01-05", "2020-01-03", "2020-01-04", "2020-01-05")
)
check_ss_ssdtc_alive_dm(SS, DM)
#> [1] FALSE
#> attr(,"msg")
#> [1] "1 patient(s) with ALIVE status date in SS domain later than death date in DM domain. "
#> attr(,"data")
#> USUBJID SSDTC SSORRES SSTESTCD VISIT DTHDTC
#> 1 3 2020-01-04 ALIVE SURVSTAT WEEK 4 2020-01-03