[R] sorting in barplot

Marc Schwartz marc_schwartz at comcast.net
Tue May 1 19:49:17 CEST 2007

On Tue, 2007-05-01 at 19:33 +0200, Romain.Mayor at ville-ge.ch 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

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.


Marc Schwartz

More information about the R-help mailing list