Skip to content

Commit 374cd0f

Browse files
committed
check for missing records
ref #400
1 parent 9e93557 commit 374cd0f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

R/redcap-read.R

+11
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,17 @@ redcap_read <- function(
391391
)
392392
}
393393

394+
unique_ids_actual <- sort(unique(ds_stacked[[id_position]]))
395+
ids_missing_rows <- setdiff(unique_ids, unique_ids_actual)
396+
397+
if (0L < length(ids_missing_rows)) {
398+
warning(sprintf(
399+
"There are %i subject(s) that are missing rows in the final dataset.\nCheck for funny values that could trip up REDCap's PHP code:\n%s.",
400+
length(ids_missing_rows),
401+
paste(ids_missing_rows, collapse="; ")
402+
))
403+
}
404+
394405
elapsed_seconds <- as.numeric(difftime( Sys.time(), start_time, units="secs"))
395406
status_code_combined <- paste(lst_status_code , collapse="; ")
396407
outcome_message_combined <- paste(lst_outcome_message, collapse="; ")

0 commit comments

Comments
 (0)