Checks for duplicate subject IDs (USUBJID) in the DS domain when randomization is indicated

check_ds_duplicate_randomization(DS)

Arguments

DS

Disposition SDTM dataset with variables USUBJID, DSDECOD

Value

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

Author

Madeleine Ma

Examples


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"