order
1
0
Entering edit mode
@heike-pospisil-1097
Last seen 10.2 years ago
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
• 945 views
ADD COMMENT
0
Entering edit mode
@sean-davis-490
Last seen 3 months ago
United States
see ?as.numeric ord <- order(as.numeric(l[,2])) On May 3, 2005, at 8:32 AM, Heike Pospisil wrote: > 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 > > _______________________________________________ > Bioconductor mailing list > Bioconductor@stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor
ADD COMMENT

Login before adding your answer.

Traffic: 531 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