From 7c211250d8047d274924145fe757ccd22bc245b1 Mon Sep 17 00:00:00 2001 From: Andreas Gammelgaard Damsbo Date: Tue, 6 Feb 2024 08:42:09 +0100 Subject: [PATCH] data handling specific to repeated and/or longitudinal projects as been wrapped in if statement to allow handling of simple projects and just split instruments --- R/REDCap_split.r | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/R/REDCap_split.r b/R/REDCap_split.r index fd67cd0..a8e5a05 100644 --- a/R/REDCap_split.r +++ b/R/REDCap_split.r @@ -92,13 +92,13 @@ REDCap_split <- function(records, metadata <- as.data.frame(process_user_input(metadata)) - # Process repeat instrument names to match the redcap naming - records$redcap_repeat_instrument <- clean_redcap_name(records$redcap_repeat_instrument) - - # Get the variable names in the dataset vars_in_data <- names(records) + # Process repeat instrument names to match the redcap naming + if (is.repeated_longitudinal(records)){ + records$redcap_repeat_instrument <- clean_redcap_name(records$redcap_repeat_instrument) + # Match arg for forms forms <- match.arg(forms, c("repeating", "all")) @@ -116,6 +116,7 @@ REDCap_split <- function(records, as.character(records$redcap_repeat_instrument) ) } + } # Standardize variable names for metadata # names(metadata) <- metadata_names @@ -198,3 +199,4 @@ REDCap_split <- function(records, out } +