Geneset_name #Chromosome #Hit_in_Biomart original_geneset_len Missing.genes [1,] "AGUIRRE_PANCREAS_CHR12" "1" "51" "59" "8" [3,] "AGUIRRE_PANCREAS_CHR9" "1" "24" "24" "0" [4,] "AGUIRRE_PANCREAS_CHR1" "1" "30" "31" "1" [5,] "AGUIRRE_PANCREAS_CHR18" "1" "17" "17" "0" [6,] "AGUIRRE_PANCREAS_CHR7" "1" "35" "48" "13" [7,] "AGUIRRE_PANCREAS_CHR8" "1" "55" "61" "6" Above is a dataframe information. i need to sort the entire dataframe based on the 3rd colum. in decending order. I tried using order information[order(information[,3])] but it gives me only the ordered first coulmn that too i am not sure that it really works. Kindly let me know with any suggestions. Regards Ramya -- View this message in context: http://www.nabble.com/Sort-help-tp20346314p20346314.html Sent from the R help mailing list archive at Nabble.com.
Hi Ramya,
You're almost there. Just specify that you want to order all the data set
based-on the third column. Here is an example:
# Data
information=data.frame(
geneset=letters[1:7],
chromosome=1,
hit=c(51,24,30,17,35,55,61))
# New data
information[order(information[,3],decreasing=TRUE),]
HTH,
Jorge
On Wed, Nov 5, 2008 at 2:02 PM, Rajasekaramya
<ramya.victory@gmail.com>wrote:
>
> Geneset_name #Chromosome #Hit_in_Biomart
> original_geneset_len Missing.genes
> [1,] "AGUIRRE_PANCREAS_CHR12" "1"
"51"
> "59" "8"
> [3,] "AGUIRRE_PANCREAS_CHR9" "1"
"24"
> "24" "0"
> [4,] "AGUIRRE_PANCREAS_CHR1" "1"
"30"
> "31" "1"
> [5,] "AGUIRRE_PANCREAS_CHR18" "1"
"17"
> "17" "0"
> [6,] "AGUIRRE_PANCREAS_CHR7" "1"
"35"
> "48" "13"
> [7,] "AGUIRRE_PANCREAS_CHR8" "1"
"55"
> "61" "6"
>
> Above is a dataframe information.
>
> i need to sort the entire dataframe based on the 3rd colum. in decending
> order.
>
> I tried using order
>
> information[order(information[,3])] but it gives me only the ordered first
> coulmn that too i am not sure that it really works.
>
> Kindly let me know with any suggestions.
>
> Regards
> Ramya
>
>
> --
> View this message in context:
> http://www.nabble.com/Sort-help-tp20346314p20346314.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.
>
[[alternative HTML version deleted]]
http://www.ats.ucla.edu/stat/R/faq/sort.htm
A great tutorial about sorting data in R.
HTH,
_____________________________________________
Patrick Richardson
Biostatistician - Program of Translational Medicine
Van Andel Research Institute - Webb Lab
Grand Rapids, MI 49503
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of Rajasekaramya
Sent: Wednesday, November 05, 2008 2:03 PM
To: r-help at r-project.org
Subject: [R] Sort help
Geneset_name #Chromosome #Hit_in_Biomart
original_geneset_len Missing.genes
[1,] "AGUIRRE_PANCREAS_CHR12" "1"
"51"
"59" "8"
[3,] "AGUIRRE_PANCREAS_CHR9" "1"
"24"
"24" "0"
[4,] "AGUIRRE_PANCREAS_CHR1" "1"
"30"
"31" "1"
[5,] "AGUIRRE_PANCREAS_CHR18" "1"
"17"
"17" "0"
[6,] "AGUIRRE_PANCREAS_CHR7" "1"
"35"
"48" "13"
[7,] "AGUIRRE_PANCREAS_CHR8" "1"
"55"
"61" "6"
Above is a dataframe information.
i need to sort the entire dataframe based on the 3rd colum. in decending
order.
I tried using order
information[order(information[,3])] but it gives me only the ordered first
coulmn that too i am not sure that it really works.
Kindly let me know with any suggestions.
Regards
Ramya
--
View this message in context:
http://www.nabble.com/Sort-help-tp20346314p20346314.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
R-help at 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.
This email message, including any attachments, is for th...{{dropped:6}}
The R wiki also discusses this: http://wiki.r-project.org/rwiki/doku.php?id=tips:data-frames:sort&s=sort On Wed, Nov 5, 2008 at 1:24 PM, Richardson, Patrick <Patrick.Richardson at vai.org> wrote:> http://www.ats.ucla.edu/stat/R/faq/sort.htm > > A great tutorial about sorting data in R. > > HTH, > > _____________________________________________ > Patrick Richardson > Biostatistician - Program of Translational Medicine > Van Andel Research Institute - Webb Lab > Grand Rapids, MI 49503 > > > -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Rajasekaramya > Sent: Wednesday, November 05, 2008 2:03 PM > To: r-help at r-project.org > Subject: [R] Sort help > > > Geneset_name #Chromosome #Hit_in_Biomart > original_geneset_len Missing.genes > [1,] "AGUIRRE_PANCREAS_CHR12" "1" "51" > "59" "8" > [3,] "AGUIRRE_PANCREAS_CHR9" "1" "24" > "24" "0" > [4,] "AGUIRRE_PANCREAS_CHR1" "1" "30" > "31" "1" > [5,] "AGUIRRE_PANCREAS_CHR18" "1" "17" > "17" "0" > [6,] "AGUIRRE_PANCREAS_CHR7" "1" "35" > "48" "13" > [7,] "AGUIRRE_PANCREAS_CHR8" "1" "55" > "61" "6" > > Above is a dataframe information. > > i need to sort the entire dataframe based on the 3rd colum. in decending > order. > > I tried using order > > information[order(information[,3])] but it gives me only the ordered first > coulmn that too i am not sure that it really works. > > Kindly let me know with any suggestions. > > Regards > Ramya > > > -- > View this message in context: http://www.nabble.com/Sort-help-tp20346314p20346314.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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. > This email message, including any attachments, is for th...{{dropped:6}} > > ______________________________________________ > R-help at 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. >