This checks looks for missing EXDOSE values when EXOCCUR="Y" or when EXOCCUR does not exist. It could be for a specified drug/treatment, or for all drugs/treatments in the dataset

check_ex_exdose_exoccur(EX, drug = NULL)

Arguments

EX

Exposure SDTM dataset with variables USUBJID, EXTRT, EXSTDTC, EXDOSE, and optional variable EXOCCUR and optional variable VISIT

drug

Drug name for EXTRT; used to subset the dataset. Default value is NULL (i.e. no filtering by drug)

Value

Boolean value for whether the check passed or failed, with 'msg' attribute if the test failed

Author

Will Harris, Pasha Foroudi

Examples


EX <- data.frame(
 USUBJID = 1:3,
 EXSEQ   = 1:3,
 EXSTDTC = 1:3,
 EXTRT   = c(1,2,NA),
 EXOCCUR = "Y",
 EXDOSE  = 1:3,
 VISIT = c("CYCLE 1 DAY 1", "CYCLE 2 DAY 1", "CYCLE 3 DAY 1")
)

check_ex_exdose_exoccur(EX)
#> [1] TRUE

EX$EXDOSE[3]=NA
check_ex_exdose_exoccur(EX)
#> [1] FALSE
#> attr(,"msg")
#> [1] "EX has 1 record(s) with missing EXDOSE when EXOCCUR = 'Y' (or EXOCCUR does not exist). "
#> attr(,"data")
#>   USUBJID EXTRT         VISIT EXSTDTC EXOCCUR EXDOSE
#> 1       3    NA CYCLE 3 DAY 1       3       Y     NA

EX$EXVISIT = NULL
check_ex_exdose_exoccur(EX)
#> [1] FALSE
#> attr(,"msg")
#> [1] "EX has 1 record(s) with missing EXDOSE when EXOCCUR = 'Y' (or EXOCCUR does not exist). "
#> attr(,"data")
#>   USUBJID EXTRT         VISIT EXSTDTC EXOCCUR EXDOSE
#> 1       3    NA CYCLE 3 DAY 1       3       Y     NA

EX$EXDOSE = NULL
check_ex_exdose_exoccur(EX)
#> [1] FALSE
#> attr(,"msg")
#> [1] "EX is missing the variable: EXDOSE"