abbrev_label: Abbreviate Labels

View source: R/utils-validation.R

abbrev_labelR Documentation

Abbreviate Labels

Description

Abbreviates labels to a maximum length, adding ellipsis if truncated.

Usage

abbrev_label(label, abbrev = NULL, n_labels = NULL)

label_abbrev(label, abbrev = NULL, n_labels = NULL)

Arguments

label

Character vector of labels to abbreviate.

abbrev

Abbreviation control:

  • NULL: No abbreviation (return labels unchanged)

  • Integer: Maximum character length (truncate + ellipsis)

  • "auto": Length chosen from the label count. Up to 5 labels are kept whole, and up to 8, 12, 20 or more labels are cut to 15, 10, 6 or 4 characters.

n_labels

Number of labels (used for "auto" mode). If NULL, uses length(label).

Value

Character vector of (possibly abbreviated) labels.

Examples

abbrev_label(colnames(regulation_net), abbrev = 4)

cograph documentation built on Nov. 19, 2026, 5:07 p.m.