motiur - 6 months ago 55

R Question

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.

Answer

There is a coercion function, `as.dist`

, that turns a matrix into the right class object for hclust:

```
> hclust( as.dist( m))
Call:
hclust(d = as.dist(m))
Cluster method : complete
Number of objects: 3
```