Converts a field exported from REDCap into a valid R vector
fieldToVar(m, d, factors = TRUE, dates = TRUE, checkboxLabels = FALSE,
vname)
a metadata file, as returned by exportMetaData
A data files, as returned by exportRecords
Logical. Determines if categorical factors from REDCap are returned with their numeric codes or as labelled factors.
Logical. Determines if date variables from REDCap are converted to POSIXct format. The API returns dates as character strings by default in YYYY-MM-DD format.
Logical. Determines the format of labels in checkbox
variables. If FALSE
labels are applies as "Unchecked"/"Checked".
If TRUE
, they are applied as ""/"[field_label]" where [field_label]
is the label assigned to the level in the data dictionary.
This option only applies when factors=TRUE
and only to
REDCap versions 6.0 and higher
The variable name being converted. This is used only when
checkboxLabels=TRUE
in order to extract the checkbox label.
This function is called internally by exportRecords
and
exportReports
. it is not available to the user.