reOrderClusterTreeMatrix: reorder rows of treeMatrix attribute of clusterTree so that...

Description Usage Arguments Value Examples

Description

reorder rows of treeMatrix attribute of clusterTree so that data points that belong to the same cluster are always next to each other. This will help us process the plot function

Usage

1

Arguments

treeMatrix

is the treeMatrix attribute of clusterTree object

order

order is the inital order of rows of x, default is c(1:n)

Value

an order which data points belong to same cluster are always next to each other

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data <- iris[,1:4]
clustering1 <- stats::hclust(dist(data),method='single')
clustering2 <- kmeans(data,centers=3)
clustering3 <- dbscan::dbscan(data,eps=.78)
res <- combineClusterings(clustering1,clustering2,clustering3) 
# obtain the order for reordering cluster tree
order <- reorderClusterTreeMatrix(res$treeMatrix)
# After reordering, data points with same cluster id are always next
# to each other
reordered_treeMatrix <- res$treeMatrix[order,]
# check reordered_treeMatrix
reordered_treeMatrix

rwoldford/trec documentation built on May 15, 2019, 6:29 p.m.