Learn R Programming

sams (version 0.4.3)

nClusters: Count the Number of Clusters in a Set Partition

Description

Count the Number of Clusters in a Set Partition

Usage

nClusters(partition)

Arguments

partition

A numeric vector representing a partition of the integers \(1\), ..., \(n\) using cluster labels

Value

The number of clusters in the given set partition as a numeric vector of length one.

Examples

Run this code
# NOT RUN {
p <- c(0,1,1,2,3,2,4,4,2)
nClusters(p)
# }

Run the code above in your browser using DataLab