[R] Boxplot labels

Marc Schwartz (via MN) mschwartz at mn.rr.com
Thu Oct 20 22:57:02 CEST 2005


On Thu, 2005-10-20 at 15:41 -0500, Marc Schwartz (via MN) wrote:
> On Thu, 2005-10-20 at 14:46 -0400, Keith Sabol wrote:
> > I am creating boxplots from a dataframe and would like to add to the 
> > standard output a marker representing the value from a particular row in the 
> > dataframe.
> > 
> > .....And I apologize if the solution is as trivial as it seems it should be.
> > 
> > Thanks for any assistance.
> > 
> > Keith
> 
> Some example code would be helpful here.
> 
> However, some hints that I suspect will be helpful:
> 
> 1. Unless you use the 'at' argument in boxplot(), the box center
> positions are at integer values from 1:n, where n is the number of
> groups. 
> 
> 2. You can thus use the points() function to add symbols or the text()
> function to add labels to the existing plot as you may require.
> See ?points and/or ?text for more information.


One other note to add here is that boxplot() will return a list which
contains various stats about your grouped data. This requires using the
form:

  stats <- boxplot(...)

Thus using the 'stats$group' and 'stats$out' components will give you
the x and y positions of any outliers. This will be helpful if these are
the values that you might want to identify

See the "Value" section in ?boxplot and ?boxplot.stats for more
information.

HTH,

Marc




More information about the R-help mailing list