This check looks for missing lab reference ranges (LBSTNRLO, LBSTNRHI) in standard units when numeric result in standard unit (LBSTRESN) is not missing and returns a data frame

check_lb_lbstnrlo_lbstnrhi(DM, LB)

Arguments

DM

DM SDTM dataset with variable USUBJID, SITEID

LB

Lab SDTM dataset with variables USUBJID, LBTEST, LBSTRESN, LBSTNRLO, LBSTNRHI

Value

boolean value if check failed or passed with 'msg' attribute if the test failed

Author

Lei Zhao

Examples


LB <- data.frame(
USUBJID = "1",
LBTEST = "Albumin",
LBSTRESN = 1:10,
LBSTNRLO = 1:10,
LBSTNRHI = 1:10,
stringsAsFactors=FALSE
)

LB$LBSTNRLO[1]=""
LB$LBSTNRLO[2]="NA"
LB$LBSTNRLO[3]=NA
LB$LBSTNRHI[3]=""
LB$LBSTNRHI[4]="NA"
LB$LBSTNRHI[5]=NA

DM <- data.frame(
USUBJID = "1",
SITEID = "123456",
stringsAsFactors=FALSE
)

check_lb_lbstnrlo_lbstnrhi(DM, LB)
#> [1] FALSE
#> attr(,"msg")
#> [1] "Lab tests with missing reference range in standard units when standard numeric result is not missing: 1 LBTEST(s) across 1 unique SITEID(s). "
#> attr(,"data")
#>   SITEID  LBTEST Freq
#> 1 123456 Albumin    5