purity: purity

Description Usage Arguments Value Examples

View source: R/external_cluster_validity.R

Description

Computes the purity of a partition as defined in https://www.ncbi.nlm.nih.gov/pubmed/17483501

Usage

1
purity(contingency, c, k)

Arguments

contingency

Table, contingency table between clusters and conditions as returned by the table function

c

Vector of classes

k

Vector of clusters

Value

Numeric

Examples

1
2
3
4
clusters <- c(0, 0, 2, 1, 1, 0, 1)
classes <- c("A", "A", "A", "B", "B", "A", "B")
ct <- table(classes, clusters)
purity(contingency = ct)

chromswitch documentation built on Nov. 8, 2020, 5:24 p.m.