Re: [R] Ordering a matrix based on cluster no

2011-06-27 Thread John Kane
r the gene name. merge (smat, bmat, by= “gene”) # untested Then apply the order command. I hope I understood the problem this time --- On Mon, 6/27/11, Aparna Sampath wrote: > From: Aparna Sampath > Subject: Re: [R] Ordering a matrix based on cluster no > To: r-help@r-project.

Re: [R] Ordering a matrix based on cluster no

2011-06-26 Thread Aparna Sampath
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: V1V2 X TEL.AML1.C41 Hyperdip.50.C23 1 TEL.AML1.C41 1TEL.AML1.C41 1.000 0.

Re: [R] Ordering a matrix based on cluster no

2011-06-26 Thread John Kane
ot;,"c", "d", "e"),5)) df1 <- data.frame(smat, bmat) orddata <- df1[order(df1[,2],decreasing=TRUE),] I hope this helps. --- On Sun, 6/26/11, Aparna Sampath wrote: > From: Aparna Sampath > Subject: [R] Ordering a matrix based on cluster no > To: r

[R] Ordering a matrix based on cluster no

2011-06-26 Thread Aparna Sampath
Hi All I have a symmetric matrix of genes ( 100x100 matrix). I also have a matrix (100x2) of two columns where column 1 has the gene names and column 2 has the cluster it belongs to (they are sorted and grouped based on the cluster no). I would like to order the rows and columns of the 100x 100 m