motiur motiur - 1 year ago 116
R Question

Use hclust on upper triangle in R

I have a matrix like so:

a b c
a 1 3 4
b 3 1 2
c 4 2 1

Is it possible to use hclust on the upper triangle, without splicing the matrix diagonally.

42- 42-
Answer Source

There is a coercion function, as.dist, that turns a matrix into the right class object for hclust:

> hclust( as.dist( m))

hclust(d = as.dist(m))

Cluster method   : complete 
Number of objects: 3 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download