labeltotable: counts the number of labels appeared in a label matrix and...

Description Usage Arguments Details Value See Also Examples

View source: R/labeltodendro.R

Description

The function is useful to make a summary table of Markov chain Monte Carlo labels for dendrogram representation. Exchangeable labels are allowed.

Usage

1

Arguments

x

a numeric matrix of integers with iterations in rows and labels in columns; each row of x corresponds to a grouping

Details

The function may not be computationally efficient for large number of iterations or large number of clustered subjects. This function counts labels and then orders the resulting table based on agglomeration and divisions of the most frequent label.

Value

labmat

A matrix of labels ordered in agglomerative order.

freq

The vector of frequencies corresponding to each row of labmat.

See Also

tabletodendro, labeltodendro, selectlabels

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,2,1,1,1,1), #exchangeable labels are allowed 
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), 
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
labtotab<-labeltotable(x)
# counts labels and summarises x

labtotab$lab
#gives labels

labtotab$freq
#gives the corresponding freqencies to the labels
          

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