Take a vector v
of indices,
then simplify the indexing system
and compact it from 1
to length(unique(v))
.
compact_index(v)
a vector of integers, used as indices.
Return a vector of integer,
that can be browsed by the code seq_len(length(unique(v)))
.
The indexing vector v
is simplified
and compacts from 1
to length(unique(v))
.
The index order is not changed, only the labels are changed.
The function is useful
for debugging computations on values sorted by a program.