R/check_sc_dm_seyeselc.R
check_sc_dm_seyeselc.Rd
Check if SC.SCCAT = "STUDY EYE SELECTION" and SC.SCTESTCD = "FOCID", then SC.SCORRES should have "OS", "OD", or "OU" values. Flag if subject is in DM and without an associated SC.SCORRES value or the STUDY EYE SELECTION value is not "OS", "OD", or "OU".
check_sc_dm_seyeselc(DM, SC)
boolean value if check failed or passed with 'msg' attribute if the test failed
dm <- data.frame(USUBJID = c(1,2))
sc <- data.frame(USUBJID = c(1,1,1,2,2,2),
SCTEST = c("Eye Meeting Eligibility Criteria",
"Focus of Study-Specific Interest",
" ",
"Eye Meeting Eligibility Criteria",
"Focus of Study-Specific Interest", " "),
SCTESTCD = c("ELIGEYE", "FOCID", "", "ELIGEYE", "FOCID", ""),
SCCAT = c("STUDY EYE SELECTION",
"STUDY EYE SELECTION",
"",
"STUDY EYE SELECTION",
"STUDY EYE SELECTION", ""),
SCORRES = c("LEFT", "OS", "", "RIGHT", "OD", ""),
SCDTC = rep("2021-01-01", 6),
stringsAsFactors = FALSE)
check_sc_dm_seyeselc(SC=sc, DM=dm)
#> [1] TRUE
dm <- data.frame(USUBJID = c(1,2,3,4))
sc <- data.frame(USUBJID = c(1,1,1,2,2,2),
SCTEST = c("Eye Meeting Eligibility Criteria",
"Focus of Study-Specific Interest",
" ",
"Eye Meeting Eligibility Criteria",
"Focus of Study-Specific Interest",
" "),
SCTESTCD = c("ELIGEYE", "FOCID", "", "ELIGEYE", "FOCID", ""),
SCCAT = c("STUDY EYE SELECTION",
"STUDY EYE SELECTION",
"",
"STUDY EYE SELECTION",
"STUDY EYE SELECTION", ""),
SCORRES = c("LEFT", "OS", "", "RIGHT", "", ""),
SCDTC = rep("2021-01-01", 6),
stringsAsFactors = FALSE)
check_sc_dm_seyeselc(SC=sc, DM=dm)
#> [1] FALSE
#> attr(,"msg")
#> [1] "3 record(s) with Study Eye Selection missing. "
#> attr(,"data")
#> USUBJID SCTESTCD SCTEST SCCAT SCORRES
#> 1 2 FOCID Focus of Study-Specific Interest STUDY EYE SELECTION
#> 2 3 <NA> <NA> <NA> <NA>
#> 3 4 <NA> <NA> <NA> <NA>
#> SCDTC
#> 1 2021-01-01
#> 2 <NA>
#> 3 <NA>