Learn R Programming

reportRmd (version 0.1.1)

set_var_labels: 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

Run this code
# 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")

Run the code above in your browser using DataLab