Check for patients with missing AGE, AGE<18 or AGE>90 in DM

check_dm_age_missing(DM)

Arguments

DM

Demographics SDTM dataset with variables USUBJID,AGE

Value

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

Author

Nina Qi

Examples


DM <- data.frame(
 USUBJID = 1:10,
 AGE = c(50,60,17,99,NA,33,500,40,22,NA)
)

check_dm_age_missing(DM)
#> [1] FALSE
#> attr(,"msg")
#> [1] "DM has 5 patient(s) with suspicious age value(s). "
#> attr(,"data")
#>   USUBJID AGE
#> 1       3  17
#> 2       4  99
#> 3       5  NA
#> 4       7 500
#> 5      10  NA

DM$AGE = NULL

check_dm_age_missing(DM)
#> [1] FALSE
#> attr(,"msg")
#> [1] "DM is missing the variable: AGE"