name change and export function

This commit is contained in:
Andreas Gammelgaard Damsbo 2024-02-07 10:09:36 +01:00
parent 881c239954
commit 4643e7a806
5 changed files with 13 additions and 15 deletions

View File

@ -96,7 +96,7 @@ REDCap_split <- function(records,
vars_in_data <- names(records) vars_in_data <- names(records)
# Process repeat instrument names to match the redcap naming # 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) records$redcap_repeat_instrument <- clean_redcap_name(records$redcap_repeat_instrument)
# Match arg for forms # Match arg for forms

View File

@ -52,7 +52,7 @@ redcap_wider <-
event.glue = "{.value}_{redcap_event_name}", event.glue = "{.value}_{redcap_event_name}",
inst.glue = "{.value}_{redcap_repeat_instance}") { inst.glue = "{.value}_{redcap_repeat_instance}") {
if (!is.repeated_longitudinal(data)) { if (!is_repeated_longitudinal(data)) {
if (is.list(data)) { if (is.list(data)) {
if (length(data) == 1) { if (length(data) == 1) {
out <- data[[1]] out <- data[[1]]

View File

@ -469,11 +469,12 @@ d2w <- function(x, lang = "en", neutrum = FALSE, everything = FALSE) {
#' and "redcap_repeat_instance" #' and "redcap_repeat_instance"
#' #'
#' @return logical #' @return logical
#' @export
#' @examples #' @examples
#' is.repeated_longitudinal(c("record_id", "age", "record_id", "gender")) #' is_repeated_longitudinal(c("record_id", "age", "record_id", "gender"))
#' is.repeated_longitudinal(redcapcast_data) #' is_repeated_longitudinal(redcapcast_data)
#' is.repeated_longitudinal(list(redcapcast_data)) #' is_repeated_longitudinal(list(redcapcast_data))
is.repeated_longitudinal <- function(data, generics = c( is_repeated_longitudinal <- function(data, generics = c(
"redcap_event_name", "redcap_event_name",
"redcap_repeat_instrument", "redcap_repeat_instrument",
"redcap_repeat_instance" "redcap_repeat_instance"

View File

@ -1,10 +1,10 @@
% Generated by roxygen2: do not edit by hand % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils.r % Please edit documentation in R/utils.r
\name{is.repeated_longitudinal} \name{is_repeated_longitudinal}
\alias{is.repeated_longitudinal} \alias{is_repeated_longitudinal}
\title{Test if repeatable or longitudinal} \title{Test if repeatable or longitudinal}
\usage{ \usage{
is.repeated_longitudinal( is_repeated_longitudinal(
data, data,
generics = c("redcap_event_name", "redcap_repeat_instrument", "redcap_repeat_instance") generics = c("redcap_event_name", "redcap_repeat_instrument", "redcap_repeat_instance")
) )
@ -22,7 +22,7 @@ logical
Test if repeatable or longitudinal Test if repeatable or longitudinal
} }
\examples{ \examples{
is.repeated_longitudinal(c("record_id", "age", "record_id", "gender")) is_repeated_longitudinal(c("record_id", "age", "record_id", "gender"))
is.repeated_longitudinal(redcapcast_data) is_repeated_longitudinal(redcapcast_data)
is.repeated_longitudinal(list(redcapcast_data)) is_repeated_longitudinal(list(redcapcast_data))
} }

View File

@ -32,9 +32,6 @@ read_redcap_tables(
\item{split_forms}{Whether to split "repeating" or "all" forms, default is \item{split_forms}{Whether to split "repeating" or "all" forms, default is
all.} all.}
\item{generics}{vector of auto-generated generic variable names to
ignore when discarding empty rows}
} }
\value{ \value{
list of instruments list of instruments