Learn R Programming

COMMUNAL (version 1.1.0)

returnCore: Assign points to core clusters

Description

Takes keyed cluster assignments of each algorithm and makes final cluster assignmenmts by majority vote. If the majority percentage is

Usage

returnCore(mat.key, agreement.thresh = 50)

Arguments

mat.key
Matrix of rekeyed cluster assignments. E.g., the output of clusterKeys.
agreement.thresh
Percent of algorithms required to agree for a cluster assignment to be accepted. Otherwise, cluster is set to 0. By default at least half the algorithms must agree.

Details

Can use examineCounts to help determine the agreement.thresh argument.

Examples

Run this code
# reindexes cluster numbers to agree
clusters <- data.frame(
  alg1=as.integer(c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3)),
  alg2=as.integer(c(1,1,1,1,1,3,3,3,3,3,2,2,2,2,2)),
  alg3=as.integer(c(3,3,3,3,3,1,1,1,1,1,2,2,2,2,2))
)
mat.key <- clusterKeys(clusters)
mat.key # cluster indices are relabeled
examineCounts(mat.key)
core <- returnCore(mat.key, agreement.thresh=50) # find 'core' clusters
table(core) # the 'core' clusters

# some clusters assignments are undetermined
clusters <- data.frame(
  alg1=as.integer(c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,1,1,2,2,3,3)),
  alg2=as.integer(c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,1,2,2,3,3,1)),
  alg3=as.integer(c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,2,3,1,1,2,3))
)
mat.key <- clusterKeys(clusters)
mat.key # last six samples have conflicting assignments
examineCounts(mat.key)
(core <- returnCore(mat.key, agreement.thresh=66)) # need at least 2 of 3 algs to agree
table(core)
(core <- returnCore(mat.key, agreement.thresh=99)) # need all algs to agree
table(core)

Run the code above in your browser using DataLab