[R] ordering boxplots according to median
Andrew Robinson
A.Robinson at ms.unimelb.edu.au
Wed Mar 22 10:19:27 CET 2006
Willem,
use the "at=" argument, and feed it the rank of the medians
eg
require(MASS)
data(iris)
boxplot(iris$Sepal.Width ~ iris$Species) # Not ordered
boxplot(iris$Sepal.Width ~ iris$Species,
at=rank(tapply(iris$Sepal.Width, iris$Species, median))) # Ordered
I hope that this helps,
Andrew
On Wed, Mar 22, 2006 at 09:59:09AM +0100, Talloen, Willem [PRDBE] wrote:
> Dear R-users,
>
> Does anyone knows how I can order my serie of boxplots from lowest to
> highest median (which is much better for visualization purposes).
>
> thanks in advance,
> willem
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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
--
Andrew Robinson
Department of Mathematics and Statistics Tel: +61-3-8344-9763
University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599
Email: a.robinson at ms.unimelb.edu.au http://www.ms.unimelb.edu.au
More information about the R-help
mailing list