start_end: Get Location of Start/End Points

View source: R/start_end.R

start_endR Documentation

Get Location of Start/End Points

Description

Get the locations of start/end places for the ones in a binary vector.

Usage

start_end(x)

Arguments

x

A vector of 1 and 0 or logical.

Value

Returns a two column data.frame of start and end locations for ones.

Author(s)

Roland (https://stackoverflow.com/users/1412059/roland) and Tyler Rinker <tyler.rinker@gmail.com>.

References

https://stackoverflow.com/a/29184841/1000343

Examples

set.seed(10); (x <- sample(0:1, 50, TRUE, c(.35, .65)))
start_end(x)
(y <- sample(c(TRUE, FALSE), 50, TRUE, c(.35, .65)))
start_end(y)

qdapTools documentation built on May 31, 2023, 7:01 p.m.