R/check_ae_ds_partial_death_dates.R
check_ae_ds_partial_death_dates.Rd
This checks looks for partial death dates in AE and DS
check_ae_ds_partial_death_dates(AE, DS, preproc = identity, ...)
Adverse Events SDTM dataset with variables USUBJID,AEDTHDTC,AEDECOD
Dispostion SDTM dataset with variables USUBJID,DSSCAT,DSSTDTC,DSDECOD
An optional company specific preprocessing script
Other arguments passed to methods
boolean value if check failed or passed with 'msg' attribute if the test failed
# test with sample data
AE <- data.frame(
USUBJID = 1:3,
AEDECOD = c("AE1","AE2","AE3"),
AEDTHDTC = c("2017-01-01","2017",NA),
AESPID = "FORMNAME-R:2/L:2XXXX",
stringsAsFactors=FALSE
)
DS <- data.frame(
USUBJID = 1:4,
DSSCAT = "STUDY DISCON",
DSDECOD = "DEATH",
DSSTDTC = c("2017-01-01","2017","2017-01-02","2016-10"),
stringsAsFactors=FALSE
)
check_ae_ds_partial_death_dates(AE,DS)
#> [1] FALSE
#> attr(,"msg")
#> [1] "There are 2 patients with partial death dates. "
#> attr(,"data")
#> USUBJID DSSCAT DSDECOD DSSTDTC AEDECOD AEDTHDTC
#> 1 2 STUDY DISCON DEATH 2017 AE2 2017
#> 2 4 STUDY DISCON DEATH 2016-10 <NA> <NA>
check_ae_ds_partial_death_dates(AE,DS,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "There are 2 patients with partial death dates. "
#> attr(,"data")
#> USUBJID DSSCAT DSDECOD DSSTDTC AEDECOD AEDTHDTC RAVE
#> 1 2 STUDY DISCON DEATH 2017 AE2 2017 FORMNAME-R:2
#> 2 4 STUDY DISCON DEATH 2016-10 <NA> <NA> <NA>
DS$DSSTDTC = NULL
check_ae_ds_partial_death_dates(AE,DS)
#> [1] FALSE
#> attr(,"msg")
#> [1] "DS is missing the variable: DSSTDTC"