Skip to contents

Converts a list of REDCap data frames from long to wide format. Handles longitudinal projects, but not yet repeated instruments.

Usage

redcap_wider(
  list,
  event.glue = "{.value}_{redcap_event_name}",
  inst.glue = "{.value}_{redcap_repeat_instance}"
)

Arguments

list

A list of data frames.

event.glue

A dplyr::glue string for repeated events naming

inst.glue

A dplyr::glue string for repeated instruments naming

Value

The list of data frames in wide format.

Examples

list <- list(data.frame(record_id = c(1,2,1,2),
redcap_event_name = c("baseline", "baseline", "followup", "followup"),
age = c(25,26,27,28)),
data.frame(record_id = c(1,2),
redcap_event_name = c("baseline", "baseline"),
gender = c("male", "female")))
redcap_wider(list)
#> Joining with `by = join_by(record_id)`
#>   record_id age_baseline age_followup gender
#> 1         1           25           27   male
#> 2         2           26           28 female