assign_label {metalite} | R Documentation |
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))
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.
Value
A data frame with labels updated.
Examples
assign_label(r2rtf::r2rtf_adae) |> head()
assign_label(
r2rtf::r2rtf_adae,
var = "USUBJID",
label = "Unique subject identifier"
) |> head()
[Package metalite version 0.1.3 Index]