R/check_cm_missing_month.R
check_cm_missing_month.Rd
Check for missing month when conmed start (CMSTDTC) or end dates (CMENDTC) have known year and day
check_cm_missing_month(CM, preproc = identity, ...)
Concomitant Medications SDTM dataset with variables USUBJID, CMTRT, CMSTDTC, CMENDTC
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
CM <- data.frame(
USUBJID = 1:3,
CMTRT = c("CM1","CM2","CM3"),
CMSTDTC = c("2017-01-01","2017---01","2017-01-02"),
CMENDTC = c("2017-02-01","2017-03-01","2017---01"),
CMSPID = "/F:XXX-D:12345-R:123",
stringsAsFactors=FALSE
)
check_cm_missing_month(CM)
#> [1] FALSE
#> attr(,"msg")
#> [1] "There are 2 patients with a conmed date that has year and day present but missing month. "
#> attr(,"data")
#> USUBJID CMTRT CMSTDTC CMENDTC
#> 1 2 CM2 2017---01 2017-03-01
#> 2 3 CM3 2017-01-02 2017---01
check_cm_missing_month(CM,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "There are 2 patients with a conmed date that has year and day present but missing month. "
#> attr(,"data")
#> USUBJID CMTRT CMSTDTC CMENDTC RAVE
#> 1 2 CM2 2017---01 2017-03-01 XXX#123
#> 2 3 CM3 2017-01-02 2017---01 XXX#123
CM$CMSTDTC = NULL
check_cm_missing_month(CM)
#> [1] FALSE
#> attr(,"msg")
#> [1] "CM is missing the variable: CMSTDTC"