Learn R Programming

diceR (version 3.0.0)

consensus_combine: Combine algorithms

Description

Combines results for multiple objects from consensus_cluster() and outputs either the consensus matrices or consensus classes for all algorithms.

Usage

consensus_combine(..., element = c("matrix", "class"))

Value

consensus_combine returns either a list of all consensus matrices or a data frame showing all the consensus classes

Arguments

...

any number of objects outputted from consensus_cluster()

element

either "matrix" or "class" to extract the consensus matrix or consensus class, respectively.

Author

Derek Chiu

Details

This function is useful for collecting summaries because the original results from consensus_cluster were combined to a single object. For example, setting element = "class" returns a matrix of consensus cluster assignments, which can be visualized as a consensus matrix heatmap.

Examples

Run this code
if (FALSE) { # rlang::is_installed("apcluster")
# Consensus clustering for multiple algorithms
set.seed(911)
x <- matrix(rnorm(500), ncol = 10)
CC1 <- consensus_cluster(x, nk = 3:4, reps = 10, algorithms = "ap",
progress = FALSE)
CC2 <- consensus_cluster(x, nk = 3:4, reps = 10, algorithms = "km",
progress = FALSE)

# Combine and return either matrices or classes
y1 <- consensus_combine(CC1, CC2, element = "matrix")
str(y1)
y2 <- consensus_combine(CC1, CC2, element = "class")
str(y2)
}

Run the code above in your browser using DataLab