time_index: Give the index of a sequence

Description Usage Arguments Details Value Examples

Description

From a sequence A A A B B C A A C C C it will returns 1 2 3 1 2 1 1 2 1 2 3.

Usage

1

Arguments

x

a vector.

Details

This is basically a wrapper around the rle function.

Value

A vector of integers of the same length as x.

Examples

1
2
x <- c("A", "A", "A", "B", "B", "C", "A", "A", "C", "C", "C")
time_index(x)

choisy/viparc documentation built on May 30, 2019, 11:38 p.m.