drops specified record name and takes name of first field for sanitizing

This commit is contained in:
Andreas Gammelgaard Damsbo 2024-02-05 21:34:16 +01:00
commit 82400b2ab9
4 changed files with 38 additions and 33 deletions

View file

@ -33,7 +33,6 @@ read_redcap_tables <- function(uri,
raw_or_label = "label",
split_forms = "all",
generics = c(
"record_id",
"redcap_event_name",
"redcap_repeat_instrument",
"redcap_repeat_instance"
@ -100,6 +99,9 @@ read_redcap_tables <- function(uri,
m <- focused_metadata(m,names(d))
}
if (any(generics %in% names(d))){
# Splitting
l <- REDCap_split(d,
m,
@ -108,7 +110,13 @@ read_redcap_tables <- function(uri,
# Sanitizing split list by removing completely empty rows apart from colnames
# in "generics"
sanitize_split(l,generics)
sanitize_split(l,c(names(d)[1],generics))
} else {
# If none of generics are present, the data base is not longitudinal,
# and does not have repeatable events, and therefore splitting does not
# make sense. But now we handle that as well.
d
}
}