Checks for exposure records with missing EXOCCUR but EXDOSE not missing

check_ex_exoccur_mis_exdose_nonmis(EX)

Arguments

EX

Exposure dataframe with variables USUBJID, EXTRT, EXDOSE, EXOCCUR, EXSTDTC

Value

boolean value if check failed or passed with 'msg' attribute if the test failed

Author

Iris Zhao

Examples


 EX <- data.frame(
 USUBJID = 1:10,
 EXTRT = rep(1,10),
 EXOCCUR = c(rep(1,2),rep(NA,4),rep(2,4)),
 EXDOSE = c(rep(NA,4),rep(1,6)),
 EXSTDTC = 1:10
)

EX$EXOCCUR[6]="NA"
EX$EXOCCUR[7]=""
EX$EXOCCUR[8]=NA

check_ex_exoccur_mis_exdose_nonmis(EX)
#> [1] FALSE
#> attr(,"msg")
#> [1] "There are 4 EX records with EXOCCUR missing but EXDOSE not missing. "
#> attr(,"data")
#>   USUBJID EXTRT EXOCCUR EXDOSE EXSTDTC
#> 1       5     1    <NA>      1       5
#> 2       6     1      NA      1       6
#> 3       7     1              1       7
#> 4       8     1    <NA>      1       8