rc_cast: Convert REDCap data to true wide format

View source: R/rc_cast.R

rc_castR Documentation

Convert REDCap data to true wide format

Description

REDCap structures data in a semi-wide format where there are 4 factor variables (record_id and the redcap event/repeat fields) followed by a column for each variable. This function will convert the redcap event and repeat to short hand notation and concatenate them, then append them to any variable names which require distinguishment based on these factors. These and any naturally wide variables will be 'zipped' (coalesced) row-wise so that the resulting data.frame has only a single row per record_id.

Usage

rc_cast(
  record_data,
  events = getOption("redcap_bundle")$event_data$unique_event_name,
  id_field = getOption("redcap_bundle")$id_field
)

Arguments

record_data

Dataframe. Record data exported from REDCap

events

Character. Vector of redcap event names. By default this will be pulled from the data dictionary.

id_field

Character. Column name of the record_id field.

Author(s)

Marcus Lehr


chillywings/rctools documentation built on Aug. 9, 2024, 11:52 p.m.