Learn R Programming

clugenr (version 1.0.4)

clusizes: Determine cluster sizes, i.e., the number of points in each cluster

Description

Cluster sizes are determined using the normal distribution (=μ= num_points / num_clusters, =/3σ=μ/3), and then assuring that the final cluster sizes add up to num_points via the fix_num_points function.

Usage

clusizes(num_clusters, num_points, allow_empty)

Value

Number of points in each cluster (vector of length num_clusters).

Arguments

num_clusters

Number of clusters.

num_points

Total number of points.

allow_empty

Allow empty clusters?

Examples

Run this code
set.seed(123)
sizes <- clusizes(4, 1000, TRUE)
sizes
sum(sizes)

Run the code above in your browser using DataLab