# NOT RUN {
showClass("consmatrix");
#you can access the slots in useful ways
#load a cmr
data(testcmr);
#get a consensus clustering matrix via the 'cm' slot
cm <- testcmr$e1_kmeans_k4@cm;
#this can be used as a distance matrix, e.g. for a heatmap
heatmap(cm);
#or as a new distance matrix
dm <- data.frame(cm) #first convert to a data.frame
#make sure names are the same for rows and columns
names(dm) <- row.names(dm);
#you need to explicitly tell cluscomp that you are passing a distance matrix
cmr2 <- cluscomp(dm,diss=TRUE,clmin=2,clmax=4,rep=2);
#for merge consensus clustering you take advantage of the reference matrix (rm) slot
#cluster robustness for agnes with cluster number (k) = 3
clrob(testcmr$merge_k3,testcmr$e1_kmeans_k3@rm);
#membership robustness for cluster 1
memrob(testcmr$merge_k3,testcmr$e1_kmeans_k3@rm)$cluster1;
# }
Run the code above in your browser using DataLab