R/check_lb_missing_month.R
check_lb_missing_month.Rd
Check for missing month when lab specimen collection date (LBDTC) has known year and day
check_lb_missing_month(LB, preproc = identity, ...)
boolean value if check failed or passed with 'msg' attribute if the test failed
LB <- data.frame(
USUBJID = 1:4,
LBTEST = c("TEST1","TEST2","TEST3","TEST3"),
LBDTC = c("2017-01-01","2017-02-01","2017---01", "2017----01"),
VISIT = c("VISIT1","VISIT2","VISIT3","VISIT3"),
stringsAsFactors=FALSE
)
check_lb_missing_month(LB)
#> [1] FALSE
#> attr(,"msg")
#> [1] "There are 2 patients with a lab date that has year and day present but missing month. "
#> attr(,"data")
#> USUBJID LBTEST LBDTC VISIT
#> 1 3 TEST3 2017---01 VISIT3
#> 2 4 TEST3 2017----01 VISIT3
LB$LBSPID= "FORMNAME-R:2/L:2XXXX"
check_lb_missing_month(LB,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "There are 2 patients with a lab date that has year and day present but missing month. "
#> attr(,"data")
#> USUBJID LBTEST LBDTC VISIT RAVE
#> 1 3 TEST3 2017---01 VISIT3 FORMNAME-R:2
#> 2 4 TEST3 2017----01 VISIT3 FORMNAME-R:2
LB$LBDTC = NULL
check_lb_missing_month(LB)
#> [1] FALSE
#> attr(,"msg")
#> [1] "LB is missing the variable: LBDTC"