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