mirror of
https://github.com/agdamsbo/REDCapCAST.git
synced 2024-11-24 22:11:55 +01:00
Compare commits
3 Commits
7948bfc65d
...
8199ec6663
Author | SHA1 | Date | |
---|---|---|---|
8199ec6663 | |||
4643e7a806 | |||
881c239954 |
@ -10,6 +10,7 @@ export(easy_redcap)
|
||||
export(focused_metadata)
|
||||
export(get_api_key)
|
||||
export(guess_time_only_filter)
|
||||
export(is_repeated_longitudinal)
|
||||
export(match_fields_to_form)
|
||||
export(read_redcap_instrument)
|
||||
export(read_redcap_tables)
|
||||
|
@ -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
|
||||
|
@ -14,8 +14,6 @@
|
||||
#' @param raw_or_label raw or label tags
|
||||
#' @param split_forms Whether to split "repeating" or "all" forms, default is
|
||||
#' all.
|
||||
#' @param generics vector of auto-generated generic variable names to
|
||||
#' ignore when discarding empty rows
|
||||
#'
|
||||
#' @return list of instruments
|
||||
#' @importFrom REDCapR redcap_metadata_read redcap_read redcap_event_instruments
|
||||
|
@ -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]]
|
||||
|
@ -26,6 +26,7 @@
|
||||
#' \item{mrs_score}{Categorical score, numeric}
|
||||
#' \item{mrs_complete}{Complete, numeric}
|
||||
#' \item{event_datetime}{Event datetime, POSIXct}
|
||||
#' \item{event_age}{Age at time of event, numeric}
|
||||
#' \item{event_type}{Event type, character}
|
||||
#' \item{new_event_complete}{Completed, character}
|
||||
#'
|
||||
|
@ -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"
|
||||
|
@ -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))
|
||||
}
|
@ -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
|
||||
|
@ -28,6 +28,7 @@ A data frame with 22 variables:
|
||||
\item{mrs_score}{Categorical score, numeric}
|
||||
\item{mrs_complete}{Complete, numeric}
|
||||
\item{event_datetime}{Event datetime, POSIXct}
|
||||
\item{event_age}{Age at time of event, numeric}
|
||||
\item{event_type}{Event type, character}
|
||||
\item{new_event_complete}{Completed, character}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user