relabel_vector: Relabels a vector to consecutive labels

Description Usage Arguments Examples

View source: R/relabel_vector.R

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

1

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

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

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

LICORS documentation built on May 1, 2019, 10:13 p.m.