Learn R Programming

nemBM (version 1.00.01)

randomizePartition: 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)

Value

A partition (in a vector format).

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.

Author

Marjan Cugmas and Aleš Žiberna

Examples

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

Run the code above in your browser using DataLab