[R] boxplot question

Marc Feldesman feldesmanm at pdx.edu
Fri Jul 27 22:00:17 CEST 2001


I'm graphing a series of boxplots of grouped data inside a function that 
passes the data.frame, the names vector, and a title vector.

Because both the data subset changes with each successive pass through the 
function, occasionally the names vector turns up with only one group to 
plot.  This is an expected result.  However, when the names argument in 
boxplot has only a single name, it doesn't put in on the 
boxplot.  (Actually, this is true whether the names argument is present or 
not.  If the call to boxplot is in formula form (e.g. variable ~ group), 
the plot doesn't name the group if there is only one group.)

Here is a small example that produces the desired boxplots and labels them 
horizontally with "GO", "HO", "PA", "PO" as I want:

attach(hominoid) #contains raw data
groups<-c("GO", "HO", "PA", "PO")
boxplot(latsupri~genus, main = "latsupri", horizontal=T, 
las=1,            names=groups)

This example produces the needed boxplot, but fails to put the "GO" 
anywhere on the plot

attach(hominoid)
groups<-"GO"  # groups<-c("GO")  doesn't do any better
boxplot(latsupri~genus, main = "latsupri", horizontal=T, las=1, names=groups)

So, since I've got lots of these to do and some of these happen to end up 
with single groups (and hence no name on the boxplot), how do I get boxplot 
to put the name of the single group in the same place it would be if there 
were more than one group?

Thanks.




=====================
Dr. Marc R. Feldesman
Professor and Chairman
Anthropology Department
Portland State University
1721 SW Broadway
Portland, Oregon 97201
email:  feldesmanm at pdx.edu
phone:  503-725-3081
fax:    503-725-3905
http://web.pdx.edu/~h1mf
PGP Key Available On Request
======================

"Anyway, no drug, not even alcohol, causes the fundamental ills of society.
If we're looking for the source of our troubles, we shouldn't test people
for drugs, we should test them for stupidity, ignorance, greed and love of
power."   P.J. O'Rourke

Powered by Optiplochoerus and Windows 2000 (scary isn't it?)

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list