Learn R Programming

functClust (version 0.1.6)

compact_index: Compact a vector of indices

Description

Take a vector v of indices, then simplify the indexing system and compact it from 1 to length(unique(v)).

Usage

compact_index(v)

Arguments

v

a vector of integers, used as indices.

Value

Return a vector of integer, that can be browsed by the code seq_len(length(unique(v))).

Details

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.