set_var_labels: Set variable labels

set_var_labelsR Documentation

Set variable labels

Description

Set variable labels for a data frame using name-label pairs.

Usage

set_var_labels(data, ...)

Arguments

data

data frame containing variables to be labelled

...

Name-label pairs the name gives the name of the column in the output and the label is a character vector of length one.

Details

If no label is provided for a variable then the existing label will not be changed. To remove a label set the label to NA.

See Also

set_labels() for setting variable labels using a data frame, extract_labels() for creating a data frame of all variable labels, clear_labels() for removing variable labels

Examples

# set labels using name-label pairs
# and return labelled data frame
data("ctDNA")
ctDNA |> set_var_labels(
   ctdna_status="detectable ctDNA",
  cohort="A cohort label")

reportRmd documentation built on April 4, 2025, 2:03 a.m.