Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

seqToHumanReadable

Gets a short human readable string representation of an vector of indices


Description

Gets a short human readable string representation of an vector of indices.

Usage

## Default S3 method:
seqToHumanReadable(idx, tau=2L, delimiter="-", collapse=", ", ...)

Arguments

idx

A vector of integer indices.

tau

A non-negative integer specifying the minimum span of of a contiguous sequences for it to be collapsed to <from>-<to>.

delimiter

A character string delimiter.

collapse

A character string used to collapse subsequences.

...

Not used.

Author(s)

Henrik Bengtsson

See Also

Internally, seqToIntervals() is used.

Examples

print(seqToHumanReadable(1:2))                 # "1, 2"
  print(seqToHumanReadable(1:2, tau=1))          # "1-2"
  print(seqToHumanReadable(1:10))                # "1-10"
  print(seqToHumanReadable(c(1:10, 15:18, 20)))  # "1-10, 15-18, 20"

R.utils

Various Programming Utilities

v2.10.1
LGPL (>= 2.1)
Authors
Henrik Bengtsson [aut, cre, cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.