Learn R Programming

ReorderCluster (version 2.0)

colorDendClass: Makes the plot of the dendrogram, visualizing the class label information with different colors of dendrogram edges.

Description

Makes the plot of the dendrogram, visualizing the class label information with different colors of dendrogram edges.

Usage

colorDendClass(dend, class)

Arguments

dend

the clustering dendrogram of the analyzed dataset.

class

a vector of length n, which stores the class labels of the dataset objects.

Details

Makes the plot of the dendrogram, visualizing the class label information with different colors of dendrogram edges.

References

Z. Bar-Joseph, D.K. Gifford, and T.S. Jaakkola. Fast optimal leaf ordering for hierarchical clustering. Bioinformatics, 17:22-29, 2001.

See Also

RearrangeJoseph, OrderingJoseph

Examples

Run this code
# NOT RUN {
data(leukemia)
rownames(leukemia)=leukemia[,1]
leukemia=leukemia[,-1]
matr=leukemia[,-101]
class=leukemia[,101]

matr=as.matrix(matr)
dist=dist(matr)
hc <- hclust(dist)
dend=as.dendrogram(hc)

label=unique(class)

Rowcolor=rainbow(length(label))
rc=matrix(0,length(class),1)

for (j in 1:length(label))
{
		index=which(class==label[j])
		rc[index]=Rowcolor[j]
}

colorDendClass(dend,rc[hc$order])
# }

Run the code above in your browser using DataLab