Arguments
- project
A list containing the REDCap data, dictionary, and event mapping (expected
redcap_data()output). Overridesdata,dic, andevent_form.- data
A
data.frameortibblewith the REDCap dataset.- dic
A
data.framewith the REDCap dictionary.- event_form
Only applicable for longitudinal projects (presence of events). Event-to-form mapping for longitudinal projects.
Value
A list with the following elements:
- data
The transformed dataset with date and datetime fields formatted as
DateandPOSIXct.- dictionary
The original REDCap dictionary passed to the function.
- event_form
The original event-form mapping (if applicable).
- results
A summary of the transformations performed.
Details
The function performs the following tasks:
Detects date and datetime fields from the REDCap dictionary (
date_*anddatetime_*validation types).Converts date fields to
Dateclass.Converts datetime fields to
POSIXctclass, treating empty strings asNA. The texts are read in UTC, whatever the time zone of the session (e.g.TZ = "Europe/Paris"): the time is kept as it is written in REDCap (e.g.2024-01-05 10:30is 10:30 UTC). The fields that are alreadyPOSIXctare left as they are.Each value is converted on its own (
YYYY-MM-DDorYYYY/MM/DD, with or without time): a value that isn't a date or a datetime (e.g. a Missing Data Code that wasn't removed) is set toNA, and a warning lists the fields and the values.
See also
Other process functions:
rd_checkbox(),
rd_delete_vars(),
rd_dictionary(),
rd_factor(),
rd_insert_na(),
rd_recalculate(),
rd_rlogic(),
rd_split(),
rd_transform()
