This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Sorting a matrix according to a factor

Hello,

I have a matrix like this

> head(b[,1:4])
       7425704 3438615 7084577 3285623
ACTB     58990   21418   28291   14254
ATP5F1    4008    1177    2105    1387
DDX5     46897   10988   15114   23206
EEF1G    50420   13007   14439   22565
GAPDH   164564   48761   62256   39132
NCL      24471    8449   10577   11618
>

I have a vector like this

> a
 [1] "3834205" "817734"  "3412270" "7147742" "7234032" "7136477"
 [7] "7436102" "162086"  "1074490" "656884"  "7157052" "3312497"
[13] "1389272" "3438615" "3398613" "3760072" "7285620" "7276574"
[19] "7198434" "3932898" "3451178" "7300340" "146248"  "3394385"
[25] "888321"  "67593"   "113895"  "121042"  "41740"   "7018463"
[31] "3708318" "1465784" "5050356" "7301529" "808923"  "1061416"
[37] "7384450" "7338018" "7208133" "7282929" "997783"  "672756" 
[43] "7187454" "3957203" "3238714" "668765"  "3875541" "1321677"
[49] "669321"  "1231706" "1733003" "7399796" "7149528" "7080375"
[55] "7104408"

How I can sort the columns of b based one the a?

rna-seq

Hello maryamtavasoli71!

We believe that this post does not fit the main topic of this site.

Pure R question. Not a bioinformatics question.

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

0 answers

No answers yet.

Log in to answer this question.