R/check_ds_dsscat.R
check_ds_dsscat.Rd
This check looks for patient who has more than one study discontinuation records
check_ds_dsscat(DS)
boolean value if check failed or passed with 'msg' attribute if the test failed
DS <- data.frame(
USUBJID = c(rep(1,3),rep(2,3),rep(3,3)),
DSSCAT= rep(c("STUDY DISCONTINUATION", "ADVERSE EVENT", "PROTOCOL"),3),
stringsAsFactors=FALSE
)
check_ds_dsscat(DS)
#> [1] TRUE
DS$DSSCAT[8] = "STUDY DISCONTINUATION"
check_ds_dsscat(DS)
#> [1] FALSE
#> attr(,"msg")
#> [1] "Patients with more than one study discontinuation records. "
#> attr(,"data")
#> USUBJID DSSCAT
#> 1 3 STUDY DISCONTINUATION
#> 2 3 STUDY DISCONTINUATION
DS$DSSCAT = NULL
check_ds_dsscat(DS)
#> [1] FALSE
#> attr(,"msg")
#> [1] "DS is missing the variable: DSSCAT"