Skip to contents

Convenience function to compute hierarchical clustering and cut the tree into k clusters

Usage

path_hcut(x, k, FUN = stats::hclust, ...)

Arguments

x

an object of class "HeFTy", "tTdiss" or "dist" (dissimilarity matrix).

k

integer. number of clusters to be generated

FUN

hierarchical clustering function to be used, i.e. one of stats::hclust() (the default), cluster::agnes(), cluster::diana()).

...

optional arguments past to hc_func

Value

an object of class "hcut" containing the result of the standard function used (read the documentation of stats::hclust(), cluster::agnes(), cluster::diana()).

It includes also

cluster

the cluster assignment of observations after cutting the tree

nbclust

the number of clusters

size

the size of clusters

Examples

data(tT_paths)
tT_paths_subset <- subset(tT_paths$paths, Comp_GOF >= 0.4)

# calculate the dissimilarities of the paths:
tT_diss <- path_diss(tT_paths_subset)
path_hcut(tT_diss$diss, 3)
#> 
#> Call:
#> FUN(d = x)
#> 
#> Cluster method   : complete 
#> Number of objects: 68 
#>