Thanks for the help! But when I tried it, it does not work the same way I want. :( after combining the two matrices, they look like this:
V1 V2 X TEL.AML1.C41 Hyperdip.50.C23 1 TEL.AML1.C41 1 TEL.AML1.C41 1.0000000 0.00000000 2 Hyperdip.50.C23 1 Hyperdip.50.C23 0.0000000 1.00000000 3 BCR.AB.LC1 1 BCR.AB.LC1 0.1212121 0.78125000 4 Hyperdip.50.C13 1 Hyperdip.50.C13 0.0000000 1.00000000 6 TEL.AML1.9 1 T.ALL.C5 0.0000000 0.03225807 7 TEL.AML1.8 1 TEL.AML1.9 1.0000000 0.00000000 8 Hyperdip.50.C7 1 TEL.AML1.8 1.0000000 0.00000000 9 TEL.AML1.C37 1 Hyperdip.50.C7 0.0000000 1.00000000 11 TEL.AML1.C47 1 TEL.AML1.C37 1.0000000 0.00000000 13 Hyperdip.50.11 1 MLL.6 0.0000000 0.03225807 when i do : orddata1 <- df2_a[order(df2_a[,1],decreasing=T),] I get the result: V1 V2 X TEL.AML1.C41 Hyperdip.50.C23 22 TEL.AML1.C49 1 TEL.AML1.2M.1 1 0.00000000 11 TEL.AML1.C47 1 TEL.AML1.C37 1 0.00000000 1 TEL.AML1.C41 1 TEL.AML1.C41 1 0.00000000 9 TEL.AML1.C37 1 Hyperdip.50.C7 0 1.00000000 6 TEL.AML1.9 1 T.ALL.C5 0 0.03225807 7 TEL.AML1.8 1 TEL.AML1.9 1 0.00000000 16 TEL.AML1.2M.4 1 Hyperdip.50.11 0 1.00000000 19 TEL.AML1.2M.1 1 TEL.AML1.2M.4 1 0.00000000 15 Hyperdip.50.R2 1 T.ALL.C10 0 0.00000000 20 Hyperdip.50.C9 1 BCR.ABL.Hyperdip.R5 0 1.00000000 The results are not right! I want it to look for the gene TEL.AML1.C49 in the second matrix and group it accordingly. Aparna -- View this message in context: http://r.789695.n4.nabble.com/Ordering-a-matrix-based-on-cluster-no-tp3625956p3627017.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.