Re: [R] sort dataframe by field

2007-01-17 Thread Benilton Carvalho
say your data.frame is called "df"

df[order(df$evidence),]

or

df[order(df$evidence, decreasing=T),] # if you want the other way  
around.

b

On Jan 17, 2007, at 11:21 AM, Milton Cezar Ribeiro wrote:

> Hi there,
>
>   How can I sort (order?) a data.frame using a dataframe field  
> (evidence) as classifyer? My data.frame looks like:
>
>   record   model   evidence
> 1 areatotha 6638.32581
> 2   areatotha_ca000 8111.01860
> 3  areatotha_ca000_Pais 1721.41828
> 4   areatotha_ca020  827.33097
> 5  areatotha_ca020_Pais 2212.40899
> 6   areatotha_ca040 3569.17169
> 7  areatotha_ca040_Pais 2940.01636
> 8   areatotha_ca060  992.62852
> 9  areatotha_ca060_Pais 4237.95709
> 10  areatotha_ca080   62.74915
> 11 areatotha_ca080_Pais 1726.55082
> 12   areatotha_Pais   52.02524
> 13  areatotha_ca000 3391.92930
> 14 areatotha_ca000_Pais   39.52170
> 15  areatotha_ca020  268.55875
> 16 areatotha_ca020_Pais   20.43317
> 17  areatotha_ca040 1698.75892
> 18 areatotha_ca040_Pais   43.90613
> 19  areatotha_ca060  350.79857
> 20 areatotha_ca060_Pais   51.04471
>
>   Cheers,
>
>   Miltinho, Brazil
>
>  __
>
>
>   [[alternative HTML version deleted]]
>
> __
> R-help@stat.math.ethz.ch 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.

__
R-help@stat.math.ethz.ch 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.


[R] sort dataframe by field

2007-01-17 Thread Milton Cezar Ribeiro
Hi there,
   
  How can I sort (order?) a data.frame using a dataframe field (evidence) as 
classifyer? My data.frame looks like:
   
  record   model   evidence
1 areatotha 6638.32581
2   areatotha_ca000 8111.01860
3  areatotha_ca000_Pais 1721.41828
4   areatotha_ca020  827.33097
5  areatotha_ca020_Pais 2212.40899
6   areatotha_ca040 3569.17169
7  areatotha_ca040_Pais 2940.01636
8   areatotha_ca060  992.62852
9  areatotha_ca060_Pais 4237.95709
10  areatotha_ca080   62.74915
11 areatotha_ca080_Pais 1726.55082
12   areatotha_Pais   52.02524
13  areatotha_ca000 3391.92930
14 areatotha_ca000_Pais   39.52170
15  areatotha_ca020  268.55875
16 areatotha_ca020_Pais   20.43317
17  areatotha_ca040 1698.75892
18 areatotha_ca040_Pais   43.90613
19  areatotha_ca060  350.79857
20 areatotha_ca060_Pais   51.04471

  Cheers,
   
  Miltinho, Brazil

 __


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.