Bug: `derive_var_afeye()` throws erroneous warnings when `xxLOC` or `xxLAT` are missing
Closed this issue · 0 comments
manciniedoardo commented
What happened?
See reproducible example. This is happening because these checks
if (!all(unique(dataset_occ[[lat_var]]) %in% lat_vals)) {
warning("Warning: value not in lat_vals")
}
if (!all(unique(dataset_occ[[loc_var]]) %in% loc_vals)) {
warning("Warning: value not in loc_vals")
}
if (!all(unique(dataset_occ$STUDYEYE) %in% seye_vals)) {
warning("Warning: STUDYEYE is expected to be 'LEFT', 'RIGHT' or 'BILATERAL'")
should have been removed and were not.
Function could also be enhanced such that user can pass in seye_vals
as well.
Session Information
No response
Reproducible Example
adae <- tribble(
~STUDYID, ~USUBJID, ~STUDYEYE, ~AELOC, ~AELAT,
"XXX001", "P01", "RIGHT", "EYE", "RIGHT",
"XXX001", "P01", "RIGHT", "EYE", "LEFT",
"XXX001", "P02", "LEFT", "", "",
)
derive_var_afeye(adae, AELOC, AELAT)