collapse_head: Collapse head of vector with commas followed by ellipsis

View source: R/utils_print.R

collapse_headR Documentation

Collapse head of vector with commas followed by ellipsis

Description

Collapse head of vector with commas followed by ellipsis

Usage

collapse_head(x, maxlength = 6L, format_fn = identity)

Arguments

x

Vector: Input whose first elements are shown.

maxlength

Integer: Maximum number of elements to show before truncating with an ellipsis. Use -1 to show all.

format_fn

Function: Formatting function applied to each element.

Details

Used, for example, by repr_ls

Value

Character.

Author(s)

EDG

Examples

collapse_head(98054:99890, maxlength = 5L)
collapse_head(
  c("mango", "banana", "tangerine", "sugar", "ackee", "cocoa bean"),
  maxlength = 3L, format_fn = toupper
)

rtemis.core documentation built on Sept. 20, 2026, 9:06 a.m.