hclust-how to get the subject name, not its cluster number
2
0
Entering edit mode
Liu, Xin ▴ 130
@liu-xin-909
Last seen 10.3 years ago
Dear all, > hc <- hclust(dist(USArrests)^2, "cen") > memb <- cutree(hc, k = 3) > memb[1:3] Alabama Alaska Arizona 1 1 1 how to get the first subject in memb "Alabama", not "1"? Thanks! Xin LIU This e-mail is from ArraDx Ltd The e-mail and any files transmitted with it are confidentia...{{dropped}}
• 1.2k views
ADD COMMENT
0
Entering edit mode
@michael-watson-iah-c-378
Last seen 10.3 years ago
Is USArrests a matrix or data.frame? Anyway, try something like: USArrests[memb==1,] to get the rows of USArrests that correspond to group/cluster "1". M -----Original Message----- From: Liu, Xin [mailto:Xin.Liu@arradx.com] Sent: Mon 11/15/2004 5:53 PM To: bioconductor@stat.math.ethz.ch Cc: Subject: [BioC] hclust-how to get the subject name, not its cluster number Dear all, > hc <- hclust(dist(USArrests)^2, "cen") > memb <- cutree(hc, k = 3) > memb[1:3] Alabama Alaska Arizona 1 1 1 how to get the first subject in memb "Alabama", not "1"? Thanks! Xin LIU This e-mail is from ArraDx Ltd The e-mail and any files transmitted with it are confidentia...{{dropped}} _______________________________________________ Bioconductor mailing list Bioconductor@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/bioconductor
ADD COMMENT
0
Entering edit mode
Liu, Xin ▴ 130
@liu-xin-909
Last seen 10.3 years ago
USArrests is a frame and the following code worked! rownames(USArrests[memb==1,])[1] Xin -----Original Message----- From: michael watson (IAH-C) [mailto:michael.watson@bbsrc.ac.uk] Sent: 15 November 2004 19:30 To: Liu, Xin; bioconductor@stat.math.ethz.ch Subject: RE: [BioC] hclust-how to get the subject name, not its cluster number Is USArrests a matrix or data.frame? Anyway, try something like: USArrests[memb==1,] to get the rows of USArrests that correspond to group/cluster "1". M -----Original Message----- From: Liu, Xin [mailto:Xin.Liu@arradx.com] Sent: Mon 11/15/2004 5:53 PM To: bioconductor@stat.math.ethz.ch Cc: Subject: [BioC] hclust-how to get the subject name, not its cluster number Dear all, > hc <- hclust(dist(USArrests)^2, "cen") > memb <- cutree(hc, k = 3) > memb[1:3] Alabama Alaska Arizona 1 1 1 how to get the first subject in memb "Alabama", not "1"? Thanks! Xin LIU This e-mail is from ArraDx Ltd The e-mail and any files transmitted with it are confidentia...{{dropped}} _______________________________________________ Bioconductor mailing list Bioconductor@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/bioconductor This e-mail is from ArraDx Ltd The e-mail and any files transmitted with it are confidentia...{{dropped}}
ADD COMMENT

Login before adding your answer.

Traffic: 644 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6