Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

relabel_vector

Relabels a vector to consecutive labels


Description

This function relabels a vector to have consecutive - no missing in between - labels. Labels always start at 1 and increase by one.

For example, c(2, 2, 5) gets relabeled to c(1, 1, 2).

Usage

relabel_vector(vec, order = FALSE)

Arguments

vec

vector with labels

order

logical; if TRUE then new state labels are assigned by decreasing number of points in that state. That is, state “1” has the most points in the state, followed by state “2” etc.

Examples

TempVec <- c(10, 2, 1, 2, 2, 2, 10)
print(relabel_vector(TempVec))

print(relabel_vector(c(2, 2, 5)))

LICORS

Light Cone Reconstruction of States - Predictive State Estimation From Spatio-Temporal Data

v0.2.0
GPL-2
Authors
Georg M. Goerg <gmg@stat.cmu.edu>
Initial release
2013-11-20

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.