Re: [R] sorting in barplot

From: Marc Schwartz <marc_schwartz_at_comcast.net>
Date: Tue, 01 May 2007 12:49:17 -0500

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 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_at_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. Received on Tue 01 May 2007 - 22:09:21 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 02 May 2007 - 16:31:05 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.