arr2int: Convert a vector of integers to a compact interval string

View source: R/misc.R

arr2intR Documentation

Convert a vector of integers to a compact interval string

Description

Takes a vector of integer values, sorts them, groups consecutive values into intervals and returns a human-readable string. For example, c(1, 5, 6, 7, 8, 20, 23, 24, 25) becomes "1, 5-8, 20, 23-25".

Usage

arr2int(x)

Arguments

x

a numeric vector of integer values.

Value

a character string with the compact representation.


mdatools documentation built on March 6, 2026, 5:08 p.m.