Thank you for your answer,

But I think it doesn't work, because the function "bargraph.CI" (I use it
because barplot doesn't have a standard error option) use two internally
function(one for mean and the other for standard error) which use something
like tapply (which sort the factors by alphabet). If I decompose the two
function and  than reorder one time with mean and one other time with
standard error, so it doesn't match on the graph.
I try also so: bargraph.CI(x.factor = REGION, response = MOY_FST, data =
Fst2,ylab = "Average Fst by pair of
populations",reorder(Fst2$REGION,Fst2$MOY_FST,mean))
with tihs Fst2 table:
  REGION MOY_FST
1      AR   0.039
2      AR   0.040
3      AR   0.041
4      AR   0.041
5      AR   0.044
6      AR   0.051
7      AR   0.055
8      AR   0.058
9      AR   0.069
10     AR   0.076
11   HT-S   0.080
12   HT-S   0.084
13   HT-S   0.090
14   HT-S   0.091
15   HT-S   0.094
16   HT-S   0.096
17     GE   0.079
18     GE   0.086
19     GE   0.095
20     GE   0.104
21     GE   0.107
22     GE   0.118
23     GE   0.119
24     GE   0.137
25     GE   0.139
26     GE   0.152
27     GE   0.178

But it doesn't work well.

RM, best regards.



                                                                           
             Marc Schwartz                                                 
             <[EMAIL PROTECTED]                                             
             mcast.net>                                                  A 
                                       [EMAIL PROTECTED]            
             01.05.2007 19:49                                           cc 
                                       r-help@stat.math.ethz.ch            
                                                                     Objet 
             Veuillez répondre         Re: [R] sorting in barplot          
                     à                                                     
             [EMAIL PROTECTED]                                             
                 cast.net                                                  
                                                                           
                                                                           
                                                                           




On Tue, 2007-05-01 at 19:33 +0200, [EMAIL PROTECTED] wrote:
> Hello,
>
> I'm trying to sort my bargraph.CI plot (function like barplot in the
> SCIPLOT package) by the mean of the response variable.
>
> Does somebody have a trick for it.
>
> Thank you.
>
> Romain Mayor, PHD student.

If it is built on top of barplot(), then by default, the factor levels
of your response variable will determine the order of the bars in the
plot.

See ?reorder.factor for more details relative to defining the order
based upon the mean of the variable. There is an example there of using
the median.

HTH,

Marc Schwartz

______________________________________________
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.

Reply via email to