# Orders objects using hierarchical clustering

### Description

Reorders objects so that similar (or high-merit) object pairs are adjacent. A permutation vector is returned.

### Usage

1 2 3 | ```
order.single(merit,clusters=NULL)
order.endlink(merit,clusters=NULL)
order.hclust(merit, reorder=TRUE,...)
``` |

### Arguments

`merit` |
is either a symmetric matrix of merit or similarity score,
or a |

`clusters` |
if non-null, specifies a partial ordering. It should be a list whose ith element contains the indices the objects in the ith ordered cluster. |

`reorder` |
if TRUE, reorders the default ordering from |

`...` |
arguments are passed to |

### Details

`order.single`

performs a variation on single-link cluster analysis,
devised by Gruvaeus and Wainer (1972).
When two ordered clusters are merged, the new cluster is formed by placing the
most similar endpoints of the joining clusters adjacent to each other.
When applied to variables, the resulting order is useful for scatterplot
matrices.

`order.endlink`

is another variation on single-link cluster analysis,
where the similarity between two ordered clusters is defined as the minimum distance
between their endpoints. When two ordered clusters are merged, the new cluster is formed by placing the
most similar endpoints of the joining clusters adjacent to each other.
When applied to variables, the resulting order is useful for parallel
coordinate displays.

`order.hclust`

returns the order of objects from `hclust`

if
`reorder`

is `FALSE`

. Otherwise, it reorders the objects using
`hclust.reorder`

so that
when two ordered clusters are merged, the new cluster is formed by placing the
most similar endpoints of the joining clusters adjacent to each other.
`order.hclust(m,method="single")`

is equivalent to
`order.single`

when `clusters`

is `NULL`

.
The default method of `hclust`

is "complete", see `hclust`

for other
possibilities.

### Value

A permutation of the objects represented by `merit`

is returned.

### Author(s)

Catherine B. Hurley

### References

Hurley, Catherine B. “Clustering Visualisations of Multidimensional Data”, Journal of Computational and Graphical Statistics, vol. 13, (4), pp 788-806, 2004.

Gruvaeus, G. and Wainer, H. (1972), “Two Additions to Hierarchical Cluster Analysis”, British Journal of Mathematical and Statistical Psychology, 25, 200-206.

### See Also

`cpairs`

,
`cparcoord`

,`plotcolors`

,
`reorder.hclust`

,`order.clusters`

, `hclust`

.

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ```
data(state)
state.cor <- cor(state.x77)
order.single(state.cor)
order.endlink(state.cor)
order.hclust(state.cor,method="average")
# Use for plotting...
cpairs(state.x77, panel.colors=dmat.color(state.cor), order.single(state.cor),pch=".",gap=.4)
cparcoord(state.x77, order.endlink(state.cor),panel.colors=dmat.color(state.cor))
# Order the states instead of the variables...
state.d <- dist(state.x77)
state.o <- order.single(-state.d)
op <- par(mar=c(1,6,1,1))
cmat <- dmat.color(as.matrix(state.d), rev(cm.colors(5)))
plotcolors(cmat[state.o,state.o], rlabels=state.name[state.o])
par(op)
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.