R/check_ds_duplicate_randomization.R
check_ds_duplicate_randomization.Rd
Checks for duplicate subject IDs (USUBJID) in the DS domain when randomization is indicated
check_ds_duplicate_randomization(DS)
boolean value if check failed or passed with 'msg' attribute if the test failed
DS <- data.frame(
USUBJID = c("ID1","ID1","ID2","ID2","ID3","ID3"),
DSDECOD = c("RANDOMIZATION","OTHER THING","RANDOMIZATION",
"OTHER THING","RANDOMIZATION","RANDOMIZATION")
, stringsAsFactors = FALSE
)
check_ds_duplicate_randomization(DS)
#> [1] FALSE
#> attr(,"msg")
#> [1] "DS has 1 patient(s) with duplicate randomization records. "
#> attr(,"data")
#> Duplicate USUBJID Number of Records
#> 3 ID3 2
DS$DSDECOD <- NULL
check_ds_duplicate_randomization(DS)
#> [1] FALSE
#> attr(,"msg")
#> [1] "DS is missing the variable: DSDECOD"