mirror of
https://github.com/agdamsbo/REDCapCAST.git
synced 2026-06-19 05:07:30 +02:00
generics field has been removed and is now handled with simpel internal helper function is.repeated_longitudinal()
This commit is contained in:
parent
7c211250d8
commit
0ce516c297
2 changed files with 52 additions and 41 deletions
27
R/utils.r
27
R/utils.r
|
|
@ -416,3 +416,30 @@ d2w <- function(x, lang = "en", neutrum=FALSE, everything=FALSE) {
|
|||
|
||||
out
|
||||
}
|
||||
|
||||
#' Test if repeatable or longitudinal
|
||||
#'
|
||||
#' @param data data set
|
||||
#' @param generics default is "redcap_event_name", "redcap_repeat_instrument"
|
||||
#' and "redcap_repeat_instance"
|
||||
#'
|
||||
#' @return logical
|
||||
#' @examples
|
||||
#' is.repeated_longitudinal(c("record_id", "age", "record_id", "gender"))
|
||||
#'
|
||||
is.repeated_longitudinal <- function(data, generics = c(
|
||||
"redcap_event_name",
|
||||
"redcap_repeat_instrument",
|
||||
"redcap_repeat_instance"
|
||||
)) {
|
||||
if (is.list(data)) {
|
||||
names <- data |>
|
||||
lapply(names) |>
|
||||
purrr::list_c()
|
||||
} else if (is.data.frame(data)) {
|
||||
names <- names(data)
|
||||
} else if (is.vector(data)) {
|
||||
names <- data
|
||||
}
|
||||
any(generics %in% names)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue