randomizePartition: Randomize a partition

View source: R/randomizePartition.R

randomizePartitionR Documentation

Randomize a partition

Description

It randomizes a partition by randomly relocating a given share of units between the clusters. The group sizes are preserved.

Usage

randomizePartition(partition, p, checkSelected = FALSE)

Arguments

partition

Initial partition in a vector format. Each unique value (positive integers) represents one cluster.

p

The share of relocated units.

checkSelected

If TRUE (default is FALSE) a given unit can be relocated only once.

Value

A partition (in a vector format).

Author(s)

Marjan Cugmas and Aleš Žiberna

Examples

randomizePartition(partition = c(1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3), p = 0.3)

nemBM documentation built on Dec. 16, 2022, 5:06 p.m.