lt_label: Rename column labels

View source: R/tab.R

lt_labelR Documentation

Rename column labels

Description

Override column headers without modifying the underlying data frame.

Usage

lt_label(x, ...)

Arguments

x

An lt() object.

...

Named arguments of the form col_name = "Display Label". Wrap a label in I() to treat it as raw HTML. Alternatively, pass a single named list or named character vector mapping column names to labels, which is convenient when the labels are computed programmatically, e.g. lt_label(x, c(mpg = "Miles/Gallon", cyl = "Cylinders")), or as a single list(names, labels) of two parallel vectors.

Value

x with the column label overrides recorded.

Examples

lt(head(mtcars)) |> lt_label(mpg = "Miles/Gallon", cyl = "Cylinders")
# raw HTML label (wrap in I())
lt(head(mtcars)) |> lt_label(mpg = I("Miles/Gallon<sup>*</sup>"))
# a single named list or vector of labels
lt(head(mtcars)) |> lt_label(c(mpg = "Miles/Gallon", cyl = "Cylinders"))
# a single list(names, labels) of two parallel vectors
lt(head(mtcars)) |> lt_label(list(c("mpg", "cyl"), c("Miles/Gallon", "Cylinders")))

lt documentation built on Oct. 17, 2026, 9:06 a.m.