Last chance! 50% off unlimited learning
Sale ends in
This function relabels a vector to have consecutive - no
missing in between - labels. Labels always start at
For example, c(2, 2, 5)
gets relabeled to
c(1, 1, 2)
.
relabel_vector(vec, order = FALSE)
vector with labels
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.
# NOT RUN {
TempVec <- c(10, 2, 1, 2, 2, 2, 10)
print(relabel_vector(TempVec))
print(relabel_vector(c(2, 2, 5)))
# }
Run the code above in your browser using DataLab