rename_by_labels {saros} | R Documentation |
Rename Dataset Columns by Labels.
Description
Occasionally dataframe columns have not been named logically and consistent in the software where the data originates. This function renames variable names based on patterns in the variable labels, after ignoring some stop words.
Occasionally dataframe columns have not been named logically and consistent in the software where the data originates. This function renames variable names based on patterns in the variable labels, after ignoring some stop words.
Usage
rename_by_labels(
data,
label_sep = " - ",
sort_var = c("pos", "variable", "label"),
new_var_sep = "_",
stop_words = NULL
)
rename_by_labels(
data,
label_sep = " - ",
sort_var = c("pos", "variable", "label"),
new_var_sep = "_",
stop_words = NULL
)
Arguments
data |
Dataset. |
label_sep |
The separator between group part and unique part of label. |
sort_var |
When numbering variables within a group, what to sort by? pos is original position in dataset, |
new_var_sep |
When creating new variables, how to glue together variable group name prefix and numbering? |
stop_words |
Words to ignore in label when abbreviating label to name. |
Value
Data with renamed variable names.
Data with renamed variable names.
Examples
rename_by_labels(ex_survey)
rename_by_labels(ex_survey)