TrueSeq: Convert TRUE Values in a Vector to a Grouped Sequence

Description Usage Arguments Value Author(s) References Examples

View source: R/TrueSeq.R

Description

Convert the TRUE values in a vector into a sequence by groups of values.

Usage

1
TrueSeq(inLogi, zero2NA = FALSE)

Arguments

inLogi

The input logical vector.

zero2NA

Logical. Should the zeroes in the result be converted to NA. Defaults to FALSE.

Value

A numeric vector

Author(s)

Ananda Mahto

References

http://stackoverflow.com/a/21328046/1270695

Examples

1
2
3
4
set.seed(1)
x <- sample(c(TRUE, FALSE), 100, TRUE)

TrueSeq(x)

mrdwab/SOfun documentation built on June 20, 2020, 6:15 p.m.