subSeq: Find sub-sequences of identical elements in a vector.

Description Usage Arguments Value Author(s) See Also Examples

View source: R/subSeq.R

Description

Find sub-sequences of identical elements in a vector.

Usage

1
subSeq(x, item = NULL)

Arguments

x

An atomic vector.

item

Optionally a specific value to look for in 'x'.

Value

A dataframe.

Author(s)

Søren Højsgaard, [email protected]

See Also

rle

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
x <- c(1, 1, 1, 0, 0, 1, 1, 1, 2, 2, 2, 1, 2, 2, 2, 3)
(ans <- subSeq(x))
ans$value
# Notice: Same results below
subSeq(x, item=1)
subSeq(x, item="1")

x <- as.character(c(1, 1, 1, 0, 0, 1, 1, 1, 2, 2, 2, 1, 2, 2, 2, 3))
(ans<-subSeq(x))
ans$value
# Notice: Same results below
subSeq(x, item="1")
subSeq(x, item=1)

doBy documentation built on Aug. 30, 2018, 9:03 a.m.