This check looks for both records where height is missing as well as DM patients with no height records at all
check_vs_height(VS, DM)
boolean value if check failed or passed with 'msg' attribute if the test failed
DM <- data.frame(
STUDYID = 1,
USUBJID = 1:10
)
VS <- data.frame(
STUDYID = 1,
USUBJID = 1:10,
VSTEST = "HEIGHT",
VSTESTCD = "HEIGHT",
VSSTRESN = 1:10,
VISIT = 1:10
)
check_vs_height(VS,DM)
#> [1] TRUE
DM <- data.frame(
STUDYID = 1,
USUBJID = 1:11
)
VS$VSSTRESN[1] = NA
VS$VSSTRESN[2] = "NA"
VS$VSSTRESN[3] = ""
VS$VSSTRESN[4] = "."
check_vs_height(VS,DM)
#> [1] FALSE
#> attr(,"msg")
#> [1] "5 patient(s) in DM with no recorded height at any visit. "
#> attr(,"data")
#> USUBJID
#> 1 1
#> 2 2
#> 3 3
#> 4 4
#> 5 11