Converts a field exported from REDCap into a valid R vector
fieldToVar(
records,
meta_data,
factors = TRUE,
dates = TRUE,
checkboxLabels = FALSE,
labels = TRUE,
handlers = list(),
mChoice = NULL,
...
)
A data frame of records returned by exportRecords
or exportReports
A data frame giving the data dictionary, as returned
by exportMetaData
Logical, determines if checkbox, radio button, dropdown and yesno variables are converted to factors
Logical, determines if date variables are converted to POSIXct format
Logical, determines if checkbox variables are labeled as
"Checked" or using the checkbox label. Only applicable when factors = TRUE
Logical. Determines if the variable labels are applied to the data frame.
List, Specify type conversion overrides for specific REDCap field types.
E.g., handlers=list(date_ = as.Date)
. For datetime specifications the
datetime ordering directive from the tail is dropped. The following field
types are supported: date_, datetime_, datetime_seconds_, time_mm_ss, time,
float, number, calc, int, integer, select, radio, dropdown, yesno, truefalse,
checkbox, and form_complete.
logical; defaults to TRUE. Convert checkboxes to mChoice if Hmisc is installed.
additional arguments that are ignored.
Jeffrey Horner
This function is called internally by exportRecords
and
exportReports
. it is not available to the user.