lt_sub: Substitute cell values

View source: R/tab.R

lt_subR Documentation

Substitute cell values

Description

Replace NA, zero, or small values with display text.

Usage

lt_sub(
  x,
  columns = NULL,
  missing = NULL,
  zero = NULL,
  small = NULL,
  small_text = NULL
)

Arguments

x

An lt() object.

columns

Character names, integer positions, a one-sided formula (predicate formulas such as ~ endsWith(., "_time") are also allowed; see lt_align()), or NULL for all.

missing

Replacement for NA cells in these columns (e.g., "n/a"). NULL (default) leaves them to the table-wide default, which is an em dash (⁠—⁠); see the lt.missing global option in lt().

zero

Replacement for zero values (e.g., "—").

small

Threshold: values whose absolute value is below this are replaced by small_text.

small_text

Text shown for values below small (e.g., "<0.1").

Value

x with the substitution recorded.

Examples

d = data.frame(x = c(1, 0, NA, 0.001))
lt(d) |> lt_sub(missing = "n/a", zero = "—", small = 0.01, small_text = "<0.01")

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