This function can add variable labels and value labels to the data. The variable labels are descriptive information about the column, and the value labels are the levels of the factor variables.
transf_label(
data,
study,
release = "latest",
add_var_label = TRUE,
add_value_label = TRUE,
id_cols_labels = c(participant_id = "Participant identifier", session_id =
"Event identifier", run_id = "Run identifier")
)A tibble with the labelled data.
tibble. The data to be transformed.
character. NBDC study (One of "abcd" or "hbcd".
character. Release version (Default: "latest").
logical. Whether to add variable labels (Default:
TRUE).
logical. Whether to add value labels (Default:
TRUE).
named character vector. A named vector of labels for the identifier columns, with the names being the column names and the values being the labels.
At least one of add_var_label or add_value_label must be set to TRUE.
If both are FALSE, an error will be raised.
The transf_factor() function has a convert_text argument,
which will convert text columns to unordered factors. When one uses
a type transformed data to add labels, the text-factor columns
will not have labels at variable level.
transf_factor() for transforming categorical columns to factors.
if (FALSE) {
transf_label(data)
}
Run the code above in your browser using DataLab