This check looks for patients in DS who have multiple records indicating death, with non-missing mismatching death dates in DSSTDTC.

check_ds_multdeath_dsstdtc(DS, preproc = identity, ...)

Arguments

DS

Disposition SDTMv dataset with variables USUBJID, DSDECOD, and DSSTDTC

preproc

An optional company specific preprocessing script

...

Other arguments passed to methods

Value

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

Author

Kimberly Fernandes

Examples


DS_error1 <- data.frame(STUDYID = rep(1, 6),
  USUBJID = c(1, 1, 1, 2, 1,1),
  DSDECOD = c("DEATH", "DEATH", rep("", 2),"DEATH","DEATH"),
  DSSCAT = LETTERS[1:6],
  DSSTDTC = c("", "2016-01-01", "", "", "2016-01-02","2016-01-01"),
  stringsAsFactors = FALSE)

DS_error2 <- data.frame(STUDYID = rep(1, 6),
  USUBJID = c(1, 1, 1, 2, 1,1),
  DSDECOD = c("DEATH", "DEATH", rep("", 2),"DEATH","DEATH"),
  DSSCAT = LETTERS[1:6],
  DSSTDTC = c("", "2016-01", "", "", "2016-01-01","2016-01-01"),
  stringsAsFactors = FALSE)
  
 DS_noerror <- data.frame(STUDYID = rep(1, 6),
                        USUBJID = c(1, 1, 1, 2, 1,1),
                        DSDECOD = c("DEATH", "DEATH", rep("", 2),"DEATH","DEATH"),
                        DSSCAT = LETTERS[1:6],
                        DSSTDTC = c("", "2016-01-01", "", "", "2016-01-01","2016-01-01"),
                        stringsAsFactors = FALSE)

check_ds_multdeath_dsstdtc(DS_error1)
#> [1] FALSE
#> attr(,"msg")
#> [1] "DS has multiple non-missing death dates in DSSTDTC that do not match. "
#> attr(,"data")
#> # A tibble: 3 × 4
#> # Groups:   USUBJID [1]
#>   USUBJID DSSCAT DSDECOD DSSTDTC   
#>     <dbl> <chr>  <chr>   <chr>     
#> 1       1 B      DEATH   2016-01-01
#> 2       1 E      DEATH   2016-01-02
#> 3       1 F      DEATH   2016-01-01
check_ds_multdeath_dsstdtc(DS_error2)
#> [1] FALSE
#> attr(,"msg")
#> [1] "DS has multiple non-missing death dates in DSSTDTC that do not match. "
#> attr(,"data")
#> # A tibble: 3 × 4
#> # Groups:   USUBJID [1]
#>   USUBJID DSSCAT DSDECOD DSSTDTC   
#>     <dbl> <chr>  <chr>   <chr>     
#> 1       1 B      DEATH   2016-01   
#> 2       1 E      DEATH   2016-01-01
#> 3       1 F      DEATH   2016-01-01
check_ds_multdeath_dsstdtc(DS_noerror)
#> [1] TRUE