| labeltodendro {labeltodendro} | R Documentation |
The function calls other internal functions to count labels, make a table of agglomerations and divisions, and gives a labclust object.
labeltodendro(x,labels=NULL)
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. |
The most frequent label will be used to search for agglomerations and divisioins and will be used for plotting and coloring the resulting dendrogram.
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. |
tabletodendro, labeltotable, colorplot, labclust
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