This check looks for non-missing diastolic BP is not higher than non-missing systolic BP
check_vs_sbp_lt_dbp(VS)
boolean value if check failed or passed with 'msg' attribute if the test failed
vs <- data.frame(
STUDYID = 1,
USUBJID = 1,
VSSPID = c("1","2","1","2"),
VISIT = 1,
VSDTC = c("2010-01-01","2010-01-01","2010-01-01","2010-01-01"),
VSTESTCD = c("SYSBP","SYSBP",
"DIABP","DIABP")
,
VSSTRESN = c(80,120,100,80)
)
vs0 <- subset(vs, select = c(USUBJID, VSSPID, VSSTRESN))
check_vs_sbp_lt_dbp(VS=vs)
#> [1] FALSE
#> attr(,"msg")
#> [1] "VS has 1 records with Systolic BP < Diastolic BP. "
#> attr(,"data")
#> USUBJID VISIT VSDTC SYSBP DIABP
#> 1 1 1 2010-01-01 80 100
check_vs_sbp_lt_dbp(VS=vs0)
#> [1] FALSE
#> attr(,"msg")
#> [1] "VS is missing the variables: VISIT, VSDTC, VSTESTCD"