labeltodendro: converts series of labels to a labclust object

Description Usage Arguments Details Value See Also Examples

View source: R/labeltodendro.R

Description

The function calls other internal functions to count labels, make a table of agglomerations and divisions, and gives a labclust object.

Usage

1
2

Arguments

x

A numeric matrix of integers with iterations in rows and labels in columns. Each row of x corresponds to a grouping.

labels

A vector of stings concering labels for each column of x; The names of associated to the clustered subjects.

Details

The most frequent label will be used to search for agglomerations and divisioins and will be used for plotting and coloring the resulting dendrogram.

Value

merge

Returns a matrix of merges according to hclust format.

height

Gives heights of each branch of merge matrix.

hcut

Shows where the tree should be cut.

See Also

tabletodendro, labeltotable, colorplot, labclust

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
x<-matrix(c(
c(1,1,1,1,1,1,1,1,1),
c(2,2,2,2,1,2,2,2,2), #exchangeable labels are allowed like this
c(1,1,1,1,1,2,2,2,2),
c(2,2,1,2,2,3,3,3,3),
c(1,1,2,1,1,3,3,3,3),#or like this 
c(1,1,2,1,1,3,3,3,3),
c(1,1,2,3,4,5,5,5,5),
c(1,1,2,3,4,5,5,5,5),
c(1,2,3,4,5,6,7,8,9)), ncol=9, byrow=TRUE) #each iteration in a row
# this creates a matrix of labels

y<-labeltodendro(x)
mydendro<-as.dendrogram(y)
colorplot(y) #uses labclust plot

plot(mydendro) #uses dendrogram plot

plot(mydendro,center=TRUE)#you may like to center the dendrogram leaves
          

labeltodendro documentation built on May 2, 2019, 5:18 p.m.