Learn R Programming

BBmisc (version 1.13)

toRangeStr: Convert a numerical vector into a range string.

Description

Convert a numerical vector into a range string.

Usage

toRangeStr(x, range.sep = " - ", block.sep = ", ")

Value

[character(1)]

Arguments

x

[integer]
Vector to convert into a range string.

range.sep

[character(1)]
Separator between the first and last element of a range of consecutive elements in x. Default is “ - ”.

block.sep

[character(1)]
Separator between non consecutive elements of x or ranges. Default is “, ”.

Examples

Run this code
x = sample(1:10, 7)
toRangeStr(x)

Run the code above in your browser using DataLab