R/check_dd_ae_aeout_aedthdtc.R
check_dd_ae_aeout_aedthdtc.Rd
This check looks for death dates if AEOUT='FATAL' and for the reverse, i.e if there is a death date, then AEOUT should have the value "FATAL".
check_dd_ae_aeout_aedthdtc(AE, preproc = identity, ...)
Adverse Events SDTM dataset with variables USUBJID, AEDTHDTC, AEDECOD, AESTDTC and AEOUT
An optional company specific preprocessing script
Other arguments passed to methods
boolean value if check failed or passed with 'msg' attribute if the test failed
AE <- data.frame(
USUBJID = 1:3,
AEDTHDTC = c("2020-01-01","2020-01-02","2020-01-03"),
AEDECOD = 1:3,
AESTDTC = 1:3,
AEOUT = rep("FATAL", 3),
AESPID = "FORMNAME-R:19/L:19XXXX",
stringsAsFactors = FALSE
)
# no case
check_dd_ae_aeout_aedthdtc(AE)
#> [1] TRUE
# 2 cases
AE[3, "AEDTHDTC"] <- NA
AE[1, "AEOUT"] <- NA
check_dd_ae_aeout_aedthdtc(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "There are 1 patients with a discrepant AE outcome and death date. "
#> attr(,"data")
#> USUBJID AEDECOD AESTDTC AEDTHDTC AEOUT
#> 3 3 3 3 <NA> FATAL
check_dd_ae_aeout_aedthdtc(AE,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "There are 1 patients with a discrepant AE outcome and death date. "
#> attr(,"data")
#> USUBJID AEDECOD AESTDTC AEDTHDTC AEOUT RAVE
#> 3 3 3 3 <NA> FATAL FORMNAME-R:19
# check for non existence of vars
AE$AEDTHDTC <- NULL
AE$USUBJID <- NULL
check_dd_ae_aeout_aedthdtc(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE is missing the variables: USUBJID, AEDTHDTC"