as.dendrogram: Dendrograms of Partitions

Description Usage Arguments Details Value Author(s) See Also Examples

Description

The functions compute a contingency table (contingency(object)) and call hclust on this matrix.

Usage

1
2
3
4
5
6
7
8
## S4 method for signature 'VegsoupPartition'
as.hclust(x, table = "constancy", ...)

## S4 method for signature 'VegsoupPartition'
as.dendrogram(object, table = "constancy", labels = NULL, ...)

## S4 method for signature 'VegsoupPartition'
reorder(x, dendrogram, ...)

Arguments

x, object

VegsoupPartition object.

table

character. Either contingency, constancy or average.

labels

character. Column of object to label dendrogram. This must of course be in line with partitioning.

dendrogram

dendrogram. Object to be used to reorder the partitions as to reflect the topology (order of tips) of a dendrogram.

...

Arguments passed to hclust and as.dendrogram, respectively.

Details

The as* methods coerce objects to the class indicated by their name. Plotting the topology of partitions can provide insights into relations of clusters to each other. As the VegsoupPartition constructor function looses the information that could be retained from hierarchical clustering methods, this is a way to rediscover parts of this information.

Method reorder uses the topology of a dendrogram to reorder the partitioning vector of an object. This can be useful to define an order for methods like constancy or latex..

Value

hclust, dendrogram, or VegsoupPartition object.

Author(s)

Roland Kaiser

See Also

VegsoupPartition

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
x <- VegsoupPartition(windsfeld, k = 10)

par(mfrow = c(3,3))

# vegdist defaults to euclidean
vegdist(x)
 
plot(as.hclust(x, "constancy"))
plot(as.hclust(x, "average"))
plot(as.hclust(x, "contingency"))

# resetting invokes recalculation of the partitioning vector!
# we will regenerate it afterwards
p <- partitioning(x)
vegdist(x) <- "bray"
x <- VegsoupPartition(x, method = "external", clustering = p)

plot(as.hclust(x, "constancy"))
plot(as.hclust(x, "average"))
plot(as.hclust(x, "contingency"))

# set method in hclust
plot(as.hclust(x, "constancy", "single"))
plot(as.hclust(x, "constancy", "complete"))
plot(as.hclust(x, "constancy", "average"))

# as.dendrogram
par(mfrow = c(2,1))
plot(as.dendrogram(x))

# define labels for as.dendrogram
x$label <- LETTERS[partitioning(x)]
plot(as.dendrogram(x, labels = "label"))

# reorder slot 'partition' with a dendrogram
# see the differnce using a constancy table
head(constancy(x))

xx <- reorder(x, as.dendrogram(x))
head(constancy(xx))

vegsoup documentation built on Feb. 24, 2021, 3 a.m.