R/check_ae_aeout.R
check_ae_aeout.Rd
This check looks for AEs with Death date(AEDTHDTC) but outcome (AEOUT) is not FATAL and conversely AEs with no death date (AEDTHDTC) but outcome (AEOUT) is fatal
check_ae_aeout(AE, preproc = identity, ...)
boolean value if check failed or passed with 'msg' attribute if the test failed
AE <- data.frame(
USUBJID = 1:8,
AEDTHDTC = c(NA, "NA", "2015-03-12", "2017-01-22", "1999-11-07","",NA, "2020-01-01"),
AEOUT = c("", "", "","FATAL","RECOVERED/RESOLVED","FATAL","FATAL", NA),
AESPID = "FORMNAME-R:13/L:13XXXX",
stringsAsFactors = FALSE
)
check_ae_aeout(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "5 AE(s) with inconsistent AEDTHDTC and AEOUT found. "
#> attr(,"data")
#> USUBJID AEDTHDTC AEOUT
#> 1 3 2015-03-12
#> 2 5 1999-11-07 RECOVERED/RESOLVED
#> 3 6 FATAL
#> 4 7 <NA> FATAL
#> 5 8 2020-01-01 <NA>
check_ae_aeout(AE,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "5 AE(s) with inconsistent AEDTHDTC and AEOUT found. "
#> attr(,"data")
#> USUBJID AEDTHDTC AEOUT RAVE
#> 1 3 2015-03-12 FORMNAME-R:13
#> 2 5 1999-11-07 RECOVERED/RESOLVED FORMNAME-R:13
#> 3 6 FATAL FORMNAME-R:13
#> 4 7 <NA> FATAL FORMNAME-R:13
#> 5 8 2020-01-01 <NA> FORMNAME-R:13
AE$AEDTHDTC <- NULL
check_ae_aeout(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE is missing the variable: AEDTHDTC"
AE$AEOUT <- NULL
check_ae_aeout(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE is missing the variables: AEDTHDTC, AEOUT"