assign_label: A function to assign labels to a data frame
Description
A function to assign labels to a data frame
Usage
assign_label(data, var = names(data), label = names(data))
Value
A data frame with labels updated.
Arguments
data
A data frame.
var
The variables to assign labels.
label
The labels to be assigned.
Details
Case 1:
If the variable's label is already define in the original data frame
but not redefined in assign_label(...), its original labels will be kept.
Case 2:
If the variable's label is already define in the original data frame
but re-defined by assign_label(...), its labels will be re-defined.
Case 3:
If the variable's label is not define in the original data frame
but it is defined by assign_label(...), its labels will added.
Case 4:
If the variable's label is not define in the original data frame,
neither was it defined by assign_label(...), its labels will be the
variable name itself.