CollapseLabels: CollapseLabels

Description Usage Arguments Details Examples

View source: R/collapse_labels.R

Description

Given a matrix of allocations, it performs a permutation on the group labels so that, if K non-empty groups are present, the labels used are exactly {1, ..., K}. Note that the value z[t,i]=0 is reserved to the inactive nodes: this transformation leaves such allocations unchanged.

Usage

1
CollapseLabels(allocations)

Arguments

allocations

A matrix whose rows identify partitions of the same elements. The entries must be positive integers. Entries equal to zero are interpreted as missing values and hence are left unchanged.

Details

The labels {1,...,G} of the clustering provided are mapped into {1,...,K} (K is less or equal than G) based on their order of appearance in the matrix provided.

Examples

1
2
3
set.seed(12345)
allocations <- matrix(sample(0:25, 25, TRUE), 5, 5)
CollapseLabels(allocations = allocations)

GreedySBTM documentation built on May 2, 2019, 12:40 a.m.