findRanges: Find contiguous ranges of values in a vector of integers

Description Usage Arguments Details Author(s) Examples

View source: R/findRanges.r

Description

Find contiguous ranges of values in a vector of integers

Usage

1
findRanges(x, output = "dt")

Arguments

x

a vector of integers

output

whether to output a data.table with columns start and end ("dt") or string ("str")

Details

if output = "dt" then a data.table with the start and end positions of contiguous ranges of integers in the vector. if output = "str" then each range is presented in a single string separated by commas e.g. "1-3,6-10,17-19"

Author(s)

Adam Waring - adam.waring@msdtc.ox.ac.uk

Examples

1
2
3
x = sample(1:10, 5)
findRanges(x, "dt")
findRanges(x, "str")

adamwaring/ClusterBurden documentation built on July 29, 2020, 9:50 p.m.