range_for: Find contiguous ranges of a given value within a sequence

Description Arguments Value Usage Author(s) Examples

Description

Identify the index ranges for a given value in a sequence and return the minimum and maximum values of the ranges.

Arguments

target

A value to find in x

x

A vector

Value

A data.frame where each row specifies the end points of a contiguous range that contains the target value

Usage

range_for(target, x)

Author(s)

Brian Lee Yung Rowe

Examples

1
2
3
# Find all contiguous ranges containing 2
x <- sample(c(1,2,2,2,3,4), 20, replace=TRUE)
range_for(2,x) 

lambda.tools documentation built on May 2, 2019, 4:28 a.m.