This check looks missing EX.VISIT values when EX.EXOCCUR=Y (or EX.EXOCCUR doesn't exist)
check_ex_visit(EX)
boolean value if check failed or passed with 'msg' attribute if the test failed
EX <- data.frame(
USUBJID = 1:3,
EXTRT = 1:3,
EXSTDTC = 1:3,
EXOCCUR = "Y",
VISIT = NA
)
check_ex_visit(EX)
#> [1] FALSE
#> attr(,"msg")
#> [1] "Total number of records is 3. "
#> attr(,"data")
#> USUBJID EXTRT EXSTDTC EXOCCUR VISIT
#> 1 1 1 1 Y NA
#> 2 2 2 2 Y NA
#> 3 3 3 3 Y NA
EX$EXOCCUR=NULL
check_ex_visit(EX)
#> [1] FALSE
#> attr(,"msg")
#> [1] "Total number of records is 3. "
#> attr(,"data")
#> USUBJID EXTRT EXSTDTC VISIT
#> 1 1 1 1 NA
#> 2 2 2 2 NA
#> 3 3 3 3 NA
EX$VISIT=NULL
check_ex_visit(EX)#
#> [1] FALSE
#> attr(,"msg")
#> [1] "EX is missing the variable: VISIT"