Check if Study is randomized (DS.DSDECOD == "RANDOMIZED" or "RANDOMIZATION"), and subject Characteristics Domain (SC) has no stratification factors reported.

check_ds_sc_strat(DS, SC)

Arguments

DS

Subject Dispostion Dataset with variable USUBJID, DSDECOD, DSSTDTC

SC

Subject Characteristics Dataset with variables USUBJID, SCTEST, SCTESTCD, SCCAT, SCORRES

Author

Monarch Shah

Examples


ds <- data.frame(USUBJID = c(1,2,2),
                 DSDECOD = c("RANDOMIZATION", "RANDOMIZED", "Randomized"),
                 DSSTDTC = c("2021-01-01", "2021-01-02", "2021-02-01"))
sc <- data.frame(USUBJID  = c(1,1,1,2,2,2),
                 SCCAT = rep("STRATIFICATION", 6),
                 SCTESTCD = c("STRAT 1", "STRAT 2", "STRAT 3", "STRAT 1", "STRAT 2", "STRAT 3"),
                 SCTEST   = c("Factor 1", "Factor 2", "Factor 3",
                              "Factor 1", "Factor 2", "Factor 3"),
                 SCORRES  = c("US", "Left", "Score > x", "RoW", "Right", "Score < x"),
                 stringsAsFactors = FALSE)

check_ds_sc_strat(ds, sc)
#> [1] TRUE

ds <- data.frame(USUBJID = c(1,2,2),
                 DSDECOD = c("RANDOMIZATION", "RANDOMIZED", "Randomized"),
                 DSSTDTC = c("2021-01-01", "2021-01-02", "2021-02-01"))
sc <- data.frame(USUBJID  = c(1,1,1),
                 SCCAT = rep("STRATIFICATION", 3),
                 SCTESTCD = c("STRAT 1", "STRAT 2", "STRAT 3"),
                 SCTEST   = c("Factor 1", "Factor 2", "Factor 3"),
                 SCORRES  = c("US", "Left", NA),
                 stringsAsFactors = FALSE)

check_ds_sc_strat(ds, sc)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 patient(s) for randomized study where stratification factors are missing. "
#> attr(,"data")
#> # A tibble: 2 × 5
#> # Groups:   USUBJID [2]
#>   USUBJID DS_RANDDT  SCTESTCD  SCTEST     SCORRES
#>     <dbl> <date>     <chr>     <chr>      <chr>  
#> 1       1 2021-01-01 "STRAT 3" "Factor 3" " "    
#> 2       2 2021-01-02 " "       " "        " "    

ds <- data.frame(USUBJID = c(1,2),
                 DSDECOD = c("Open Label", "Open Label"),
                 DSSTDTC = c("2021-01-01", "2021-01-02"))
sc <- data.frame(USUBJID  = c(1,1,1,2,2,2),
                 SCCAT = rep("No STRATIFICATION", 6),
                 SCTESTCD = c("STRAT 1", "STRAT 2", "STRAT 3", "STRAT 1", "STRAT 2", "STRAT 3"),
                 SCTEST   = c("Factor 1", "Factor 2", "Factor 3",
                              "Factor 1", "Factor 2", "Factor 3"),
                 SCORRES  = c("US", "Left", NA, "RoW", "Right", "Score < x"),
                 stringsAsFactors = FALSE)

check_ds_sc_strat(ds, sc)
#> [1] FALSE
#> attr(,"msg")
#> [1] "Only applicable for randomized studies. Based on DS, no records were found indicating randomized patients."