This check looks for missing AETOXGR and/or AESEV values and returns a data frame. If both variables exist it returns records where both are missing.
check_ae_aetoxgr(AE, preproc = identity, ...)
Adverse Events SDTM dataset with variables USUBJID, AESTDTC, AEDECOD, AETERM, and AETOXGR (or AESEV)
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
# test with sample data
AE <- data.frame(
USUBJID = 1:3,
DOMAIN = c(rep("AE", 3)),
AESEQ = 1:3,
AESTDTC = 1:3,
AETERM = c("FLU COUGH", "HEADACHE", "FEVER"),
AEDECOD = c("", "Headache", "Fever"),
AETOXGR = 1:3,
AESEV = 1:3,
AESPID = "FORMNAME-R:16/L:16XXXX",
stringsAsFactors = FALSE
)
check_ae_aetoxgr(AE)
#> [1] TRUE
AE$AETOXGR[1] <- NA
check_ae_aetoxgr(AE)
#> [1] TRUE
AE$AESEV[1] <- NA
check_ae_aetoxgr(AE,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE has records where both AESEV and AETOXGR have missing values. "
#> attr(,"data")
#> USUBJID AETERM AESTDTC AEDECOD AETOXGR AESEV RAVE
#> 1 1 FLU COUGH 1 NA NA FORMNAME-R:16
AE$AETOXGR <- NULL
check_ae_aetoxgr(AE,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE has 1 record(s) with missing AESEV"
#> attr(,"data")
#> USUBJID AESTDTC AETERM AEDECOD AESEV RAVE
#> 1 1 1 FLU COUGH NA FORMNAME-R:16
AE$AESPID <- NULL
check_ae_aetoxgr(AE,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE has 1 record(s) with missing AESEV"
#> attr(,"data")
#> USUBJID AESTDTC AETERM AEDECOD AESEV
#> 1 1 1 FLU COUGH NA
AE$AESEV <- NULL
check_ae_aetoxgr(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE is missing both the AETOXGR and AESEV variable."
AE$AEDECOD <- NULL
check_ae_aetoxgr(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE is missing the variable: AEDECOD"