Learn R Programming

labeltodendro (version 1.3)

labeltodendro: converts series of labels to a labclust object

Description

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

Usage

labeltodendro(x,labels=NULL)

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.

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.

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.

See Also

tabletodendro, labeltotable, colorplot, labclust

Examples

Run this code
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
          

Run the code above in your browser using DataLab