reordclust {optpart} | R Documentation |
Re-order Clusters in a Classification
Description
In it's simplest form simply reassigns cluster numbers in an existing classification to re-order tables and graphs. Can also be used to combine clusters into a fewer number of clusters.
Usage
reordclust(clustering,from,to)
Arguments
clustering |
a vector of (interger) cluster mmeberships, or an object of class ‘clustering’, ‘partana’, or ‘partition’ |
from |
an integer vector equal in length to the number of clusters that specifies the current clusters |
to |
an integer vector equal in length to the number of clusters that specifies the clusters the current clusters map to |
Details
The function simply maps cluster numbers in the ‘from’ vector to the respective cluster number in the ‘to’ vector.
Value
an object of class ‘clustering’
Note
As demonstrated in the examples below, reordclass can also combine existing clusters into fewer clusters while reordering if more than one cluster in the ‘from’ vector maps to the same cluster in the ‘to’ cluster.
Author(s)
David W. Roberts droberts@montana.edu
References
http://ecology.msu.montana.edu/labdsv/R
See Also
mergeclust
Examples
data(shoshveg)
dis.bc <- dsvdis(shoshveg,'bray')
opt.10 <- optpart(10,dis.bc)
new <- reordclust(opt.10,1:10,c(1,3,5,7,9,2,4,6,8,10))
# simply re-ordered
new2 <- reordclust(opt.10,1:10,c(1,1,2,2,3,3,4,4,5,5))
# merge 1 and 2 into 1, 3 and 4 into 2, etc.