R/check_dm_usubjid_ae_usubjid.R
check_dm_usubjid_ae_usubjid.Rd
This check looks for patients in the DM dataset who do not have records in the AE dataset, and obtains first treatment start date and earliest death date for these patients
check_dm_usubjid_ae_usubjid(DM, AE, DS, EX)
boolean value if check failed or passed with 'msg' attribute if the test failed
USUBJID<- c(1:10)
DM=data.frame(USUBJID)
AE=data.frame(USUBJID)
AE$USUBJID[3]=NA
AE$USUBJID[8]=NA
AE$USUBJID[10]=NA
EX <- data.frame(
USUBJID = c(1:8, 6, 8, 10, 10, 10, 10),
EXOCCUR = rep("Y", times=14),
EXDOSE = rep(c(1,2), times=7),
EXSTDTC = c(rep("2012-01-01", 10),"2012-02-04","2012-02-04", "", "2012-02-07"),
EXTRT = "GDC",
stringsAsFactors=FALSE
)
DS <- data.frame(
USUBJID = c(2,8,8),
DSDECOD = rep("DEATH", times=3),
DSSTDTC = c("2012-12-01", NA, "2013-07-01"),
stringsAsFactors=FALSE
)
check_dm_usubjid_ae_usubjid(DM, AE, DS, EX)
#> [1] FALSE
#> attr(,"msg")
#> [1] "There is/are 3 patient(s) in DM without Adverse Events reported. "
#> attr(,"data")
#> USUBJID EXSTDTC DSDECOD DSSTDTC
#> 1 3 2012-01-01
#> 2 8 2012-01-01 DEATH 2013-07-01
#> 3 10 2012-02-04
EX$EXOCCUR[3]="N"
check_dm_usubjid_ae_usubjid(DM, AE, DS, EX)
#> [1] FALSE
#> attr(,"msg")
#> [1] "There is/are 3 patient(s) in DM without Adverse Events reported. "
#> attr(,"data")
#> USUBJID EXSTDTC DSDECOD DSSTDTC
#> 1 3
#> 2 8 2012-01-01 DEATH 2013-07-01
#> 3 10 2012-02-04
EX$EXOCCUR=NULL
check_dm_usubjid_ae_usubjid(DM, AE, DS, EX)
#> [1] FALSE
#> attr(,"msg")
#> [1] "There is/are 3 patient(s) in DM without Adverse Events reported. "
#> attr(,"data")
#> USUBJID EXSTDTC DSDECOD DSSTDTC
#> 1 3 2012-01-01
#> 2 8 2012-01-01 DEATH 2013-07-01
#> 3 10 2012-02-04