find_parent {lazy.cluster}R Documentation

Given A class hclust merge matrix and parent names, find the parent of each observation and cluster.

Description

Given A class hclust merge matrix and parent names, find the parent of each observation and cluster.

Usage

find_parent(merge = NULL, parent = 1:nrow(merge), print = 0)

Arguments

merge

class hclust merge matrix

parent

parent name

print

= 1 to print the result

Examples

# two clusters at each division
resdhc2 <- dhclust( unidimdata, ndiv=2, plot=1, print=3
    , maxclustersize=1, method="LS" )
fs2=resdhc2$fusionhistory
parentinfo <- find_parent( fs2[,c(3,5,7)], parent=fs2[,2], print=1 )

# three clusters at each division
resdhc3 <- dhclust( unidimdata, ndiv=3, plot=1, print=3
    , maxclustersize=1, method="LS" )
fs3=resdhc3$fusionhistory
parentinfo <- find_parent( fs3[,c(3,5,7)], parent=fs3[,2], print=1 )

# from abbreviated tree:  parent1=0 means unknown (misleading)
resdhc22 <- dhclust( unidimdata, ndiv=2, plot=1, print=3
    , maxclustersize=2, method="LS" )
fs22=resdhc22$tree_s$fusionhistory
parentinfo <- find_parent( fs22[,c(3,5,7)], parent=fs22[,2], print=1 )

# from native hclust
reshc <- hclust( dist(unidimdata) )
plot(reshc, hang=-1)
parentinfo <- find_parent( reshc$merge, print=1  )



[Package lazy.cluster version 0.1.4 Index]