From 4643e7a8062bafaa5ef4a4a632d79b84a3c9d661 Mon Sep 17 00:00:00 2001 From: Andreas Gammelgaard Damsbo Date: Wed, 7 Feb 2024 10:09:36 +0100 Subject: [PATCH] name change and export function --- R/REDCap_split.r | 2 +- R/redcap_wider.R | 2 +- R/utils.r | 9 +++++---- ...d_longitudinal.Rd => is_repeated_longitudinal.Rd} | 12 ++++++------ man/read_redcap_tables.Rd | 3 --- 5 files changed, 13 insertions(+), 15 deletions(-) rename man/{is.repeated_longitudinal.Rd => is_repeated_longitudinal.Rd} (65%) diff --git a/R/REDCap_split.r b/R/REDCap_split.r index f4c4ea3..6f9e3c9 100644 --- a/R/REDCap_split.r +++ b/R/REDCap_split.r @@ -96,7 +96,7 @@ REDCap_split <- function(records, vars_in_data <- names(records) # Process repeat instrument names to match the redcap naming - if (is.repeated_longitudinal(records)){ + if (is_repeated_longitudinal(records)){ records$redcap_repeat_instrument <- clean_redcap_name(records$redcap_repeat_instrument) # Match arg for forms diff --git a/R/redcap_wider.R b/R/redcap_wider.R index 5edaa7e..7f8fbbd 100644 --- a/R/redcap_wider.R +++ b/R/redcap_wider.R @@ -52,7 +52,7 @@ redcap_wider <- event.glue = "{.value}_{redcap_event_name}", inst.glue = "{.value}_{redcap_repeat_instance}") { - if (!is.repeated_longitudinal(data)) { + if (!is_repeated_longitudinal(data)) { if (is.list(data)) { if (length(data) == 1) { out <- data[[1]] diff --git a/R/utils.r b/R/utils.r index fb2294c..eec3fcd 100644 --- a/R/utils.r +++ b/R/utils.r @@ -469,11 +469,12 @@ d2w <- function(x, lang = "en", neutrum = FALSE, everything = FALSE) { #' and "redcap_repeat_instance" #' #' @return logical +#' @export #' @examples -#' is.repeated_longitudinal(c("record_id", "age", "record_id", "gender")) -#' is.repeated_longitudinal(redcapcast_data) -#' is.repeated_longitudinal(list(redcapcast_data)) -is.repeated_longitudinal <- function(data, generics = c( +#' is_repeated_longitudinal(c("record_id", "age", "record_id", "gender")) +#' is_repeated_longitudinal(redcapcast_data) +#' is_repeated_longitudinal(list(redcapcast_data)) +is_repeated_longitudinal <- function(data, generics = c( "redcap_event_name", "redcap_repeat_instrument", "redcap_repeat_instance" diff --git a/man/is.repeated_longitudinal.Rd b/man/is_repeated_longitudinal.Rd similarity index 65% rename from man/is.repeated_longitudinal.Rd rename to man/is_repeated_longitudinal.Rd index c8e8fc4..c12bfd2 100644 --- a/man/is.repeated_longitudinal.Rd +++ b/man/is_repeated_longitudinal.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/utils.r -\name{is.repeated_longitudinal} -\alias{is.repeated_longitudinal} +\name{is_repeated_longitudinal} +\alias{is_repeated_longitudinal} \title{Test if repeatable or longitudinal} \usage{ -is.repeated_longitudinal( +is_repeated_longitudinal( data, generics = c("redcap_event_name", "redcap_repeat_instrument", "redcap_repeat_instance") ) @@ -22,7 +22,7 @@ logical Test if repeatable or longitudinal } \examples{ -is.repeated_longitudinal(c("record_id", "age", "record_id", "gender")) -is.repeated_longitudinal(redcapcast_data) -is.repeated_longitudinal(list(redcapcast_data)) +is_repeated_longitudinal(c("record_id", "age", "record_id", "gender")) +is_repeated_longitudinal(redcapcast_data) +is_repeated_longitudinal(list(redcapcast_data)) } diff --git a/man/read_redcap_tables.Rd b/man/read_redcap_tables.Rd index e97c4c1..96bbee4 100644 --- a/man/read_redcap_tables.Rd +++ b/man/read_redcap_tables.Rd @@ -32,9 +32,6 @@ read_redcap_tables( \item{split_forms}{Whether to split "repeating" or "all" forms, default is all.} - -\item{generics}{vector of auto-generated generic variable names to -ignore when discarding empty rows} } \value{ list of instruments