twinid: Get Twinspan Classs Identiers for Clustering Object

twinidR Documentation

Get Twinspan Classs Identiers for Clustering Object

Description

Twinspan returns the classification topology as a single integer vector. These functions find similar classification identifiers for each sampling unit, or cut that vector for a lower number of classes.

Usage

twinid(hclust, ...)

## S3 method for class 'twinid'
cut(x, level, binname = FALSE, ...)

Arguments

hclust

Cluster Analysis result compatible with hclust.

...

Other parameters to functions (ignored).

x

Vector of classification IDs from twinind.

level

Level of hierarchy of classification. If missing, level used in the object will be returned.

binname

Use binary labels instead of decimal class numbers.

Details

Twinspan expresses the topology of cluster tree as an integer. When a cluster z is split into two, its daughters will be 2z and 2z+1, and its parent cluster is found with integer division z/2. The classification vector only stores the topology of the trees, and has no information on heights.

twinspan will not split small clusters and only proceeds to a defined depth of divisions. In contrast, twinind proceeds to each terminal unit (leaf, sampling unit, quadrat) and these will all have unique identifiers. With cut function you can restrict the identifiers to certain level of classification similarly as in twinspan (see cut.twinspan).

Value

Vector of class "twinid" giving twinspan id of each sampling unit.

Warning

If the classification is deep and has many (> 30) levels of hierarchy, the identifiers can exceed the integer maximum in R, and leaves may have non-unique identifiers, and may not recover the correct topoloty. However, they may still be unique beyond this limit, but the user should check this after getting a warning.

Examples

data(ahti)
cl <- hclust(dist(ahti, "manhattan"), "average")
(id <- twinid(cl))
cut(id, 6)
table(cut(id, 6))


jarioksa/twinspan documentation built on Nov. 23, 2024, 2:49 p.m.