This check looks if AESOC has Eye, and AELAT is missing.
check_ae_aelat(AE, preproc = identity, ...)
boolean value if check failed or passed with 'msg' attribute if the test failed
AE <- data.frame(
USUBJID = 1:5,
AESTDTC = 1:5,
AELOC = c("", "EYE", "eye", "", "EYE"),
AELAT = c("Left", "","left", "RIGHT", ""),
AETERM = c("A", "B", "A", "B", "A"),
AEDECOD = c("A", "B", "A", "B", "A"),
AESOC = c("Eye", "Eye","Eye Disorder","Eye Disorder", "Eye"),
AESPID = "FORMNAME-R:19/L:19XXXX",
stringsAsFactors = FALSE)
check_ae_aelat(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 record(s) with AELAT Missing, when AE is Eye related. "
#> attr(,"data")
#> USUBJID AESTDTC AELAT AESOC AEDECOD AETERM
#> 1 2 2 Eye B B
#> 2 5 5 Eye A A
check_ae_aelat(AE,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 record(s) with AELAT Missing, when AE is Eye related. "
#> attr(,"data")
#> USUBJID AESTDTC RAVE AELAT AESOC AEDECOD AETERM
#> 1 2 2 FORMNAME-R:19 Eye B B
#> 2 5 5 FORMNAME-R:19 Eye A A
AE <- data.frame(
USUBJID = 1:5,
AESTDTC = 1:5,
AELAT = c("Left", "","Bilateral", "", ""),
AETERM = c("A", "B", "A", "B", "A"),
AEDECOD = c("A", "B", "A", "B", "A"),
AESOC = c("Eye", "Eye","Eye Disorder","Eye Disorder", "Eye"),
stringsAsFactors = FALSE)
check_ae_aelat(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "3 record(s) with AELAT Missing, when AE is Eye related. "
#> attr(,"data")
#> USUBJID AESTDTC AELAT AESOC AEDECOD AETERM
#> 1 2 2 Eye B B
#> 2 4 4 Eye Disorder B B
#> 3 5 5 Eye A A
check_ae_aelat(AE,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "3 record(s) with AELAT Missing, when AE is Eye related. "
#> attr(,"data")
#> USUBJID AESTDTC AELAT AESOC AEDECOD AETERM
#> 1 2 2 Eye B B
#> 2 4 4 Eye Disorder B B
#> 3 5 5 Eye A A