netClass {NetComp} | R Documentation |
Returns an unweighted adjacency matrix with a '1' where observations are from the same class, '0' if from different classes based on a vector of class assingments.
netClass(x, labels=NULL)
x |
Numeric vector containing the class/cluster assignments |
labels |
Optional. Vector of labels for the individual observations |
Used for converting class/community assingments into an adjacency matrix.
A square matrix is returned with the number of rows, columns equal to the length of x
and in the same order. If lables
is supplied, they will be used as the row/column names.
Shannon M. Bell
hclust{cutree}
#using the USArrest dataset arrestCor<-cor(t(USArrests)) tree<-cutree(hclust(as.dist(1-arrestCor), method='ward'), k=10) netClass(tree, labels=colnames(arrestCor))