This check looks for missing ARM or ARMCD values
check_dm_armcd(DM)
boolean value if check failed or passed with 'msg' attribute if the test failed
DM <- data.frame(
USUBJID = 1:3,
ARM = 1:3,
ARMCD = 1:3
)
check_dm_armcd(DM)
#> [1] TRUE
DM$ARMCD[1] <- NA
check_dm_armcd(DM)
#> [1] FALSE
#> attr(,"msg")
#> [1] "Total number of patients with missing ARM/ARMCD values is 1. "
#> attr(,"data")
#> USUBJID ARM ARMCD
#> 1 1 1 NA
DM$ARM[2] <- NA
check_dm_armcd(DM)
#> [1] FALSE
#> attr(,"msg")
#> [1] "Total number of patients with missing ARM/ARMCD values is 2. "
#> attr(,"data")
#> USUBJID ARM ARMCD
#> 1 1 1 NA
#> 2 2 NA 2
DM$ARMCD <- NULL
check_dm_armcd(DM)
#> [1] FALSE
#> attr(,"msg")
#> [1] "DM is missing the variable: ARMCD"