[R] Alphabetical sequence of data along the x-axis in a box plot

Peter Alspach Peter.Alspach at plantandfood.co.nz
Mon Sep 27 22:50:36 CEST 2010


Tena koe Eddie

One way:

eddie <- data.frame(grp=rep(c('small','medium','large','very large'), each=20), wgt=rnorm(80, 100, 10))
with(eddie, plot(grp, wgt))
eddie$grp <- factor(eddie$grp, levels=c('small','medium','large','very large'))
with(eddie, plot(grp, wgt))

HTH ...

Peter Alspach

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Hughes, Ed
> Sent: Tuesday, 28 September 2010 9:00 a.m.
> To: r-help at r-project.org
> Subject: [R] Alphabetical sequence of data along the x-axis in a box
> plot
> 
> Hello All,
> 
> 
> 
> I noticed when I generated some boxplots, the data is presented in
> alphabetical order along the x-axis (the data in this case was the four
> quandrants of a sample area (NE,NW, SE, SW) that was my first column of
> data).  Is there a way to have R plot the data in a different order?  I
> imagine you could use a dummy variable, but didn't know if there might
> be a simple argument  that will address this?
> 
> 
> 
> Thanks for any guidance,
> 
> Eddie Hughes
> 
> 
> 
> 
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org 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.

The contents of this e-mail are confidential and may be subject to legal privilege.
 If you are not the intended recipient you must not use, disseminate, distribute or
 reproduce all or any part of this e-mail or attachments.  If you have received this
 e-mail in error, please notify the sender and delete all material pertaining to this
 e-mail.  Any opinion or views expressed in this e-mail are those of the individual
 sender and may not represent those of The New Zealand Institute for Plant and
 Food Research Limited.



More information about the R-help mailing list