[R] Instruction summary-hclust hierarchy cluster package

Source: Internet
Author: User
"R Hierarchy cluster--hclust package"
http://blog.csdn.net/sherrymi/article/details/38341185


Hclust (d, method = "complete", Members=null)
D is the distance matrix.
Method represents the merging methods of the class, which are:
Single Shortest distance method
Complete the longest distance method
Median intermediate distance method
McQuitty Similarity method
Average class averaging method
Centroid Center of gravity method
Ward Deviation squared sum method


# ' Example
D <-Dist (x)
HC <-Hclust (d, "single")
Plot (HC)


# ' Then you can use Rect.hclust (tree, k = null, which = NULL, x = null, h = Null,border = 2, cluster = NULL) to determine the number of classes. # ' tree is the object of the finding. K is the number of classifications, and H is the threshold for the distance between classes. Border are painted colors that are used for classification.
Rect.hclust (hc,k=2)
Rect.hclust (hc,h=0.5)


# ' Extract the categories to which each sample belongs
Label <-Cutree (hc,k=2)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.