[BioC] order

Heike Pospisil pospisil at zbh.uni-hamburg.de
Tue May 3 14:32:18 CEST 2005


Hello everybody,

I have a question concerning the order function in R. I have a matrix of genes 
(X1) and the corresponding p-values (X2):

 > l
      X1                   X2
1  97511    0.954592909444367
2  97522    0.999844154885015
3  97534    0.922142091452795
4  97560    0.978737666181316
5  97599    0.530776889626182
6  97607    0.254772654483606
7  97842 1.49336790005039e-07
8  98251    0.903879966892844
9  98606    0.212427336357742
10 98783    0.408353158009378
11 98785    0.293268511926562

I would like to sort this list by the p-values.

 > ord<-order(l[,2])


Unfortunately, I do not get the numerical sorted p-values, but the 
alphanumerical orderd values:

 > l[ord,]
       X1                   X2
9  98606    0.212427336357742
6  97607    0.254772654483606
11 98785    0.293268511926562
10 98783    0.408353158009378
5  97599    0.530776889626182
8  98251    0.903879966892844
3  97534    0.922142091452795
1  97511    0.954592909444367
4  97560    0.978737666181316
2  97522    0.999844154885015
7  97842 1.49336790005039e-07

Do you have any hint to sort this list numerically?

Thanks in advance.
Heike
-- 
Dr. Heike Pospisil
Center for Bioinformatics, University of Hamburg
Bundesstrasse 43, 20146 Hamburg, Germany
phone: +49-40-42838-7303 fax: +49-40-42838-7312



More information about the Bioconductor mailing list