[R] More factor names in x axis, how?

Richard A. O'Keefe ok at cs.otago.ac.nz
Tue Mar 9 05:09:23 CET 2004


I have some data which records, amongst other things,
age (recoded by me to be in months), and
drug group (a factor).
The drug group is a 2 digit number,
but there is no numeric relationship, and only 50 of the possible
groups occur

So

> asd <- read.table("asd.dat", header=TRUE)
> asd$group <- as.factor(asd$group)
> plot(age ~ group, data=asd)

gives me a series of boxplots which suggests that the age
distributions are worth examining further,
BUT while every factor level in the data is represented by
a tick mark on the x axis, only about half of the ticks
are labelled with the factor level.  Because the factor
levels which occur are not consecutive integers, I cannot
tell what some of the tick marks represent.

There is enough room for all the factor levels to be printed,
but I cannot figure out how to make that happen.  Shrinking
the labels with cex=0.5 (or even smaller) was the obvious thing
to try, but while making the labels bigger reduced the number of
factor levels shown, making the labels smaller didn't increase it.

I have checkd ?par and ?plot and ?plot.default and don't see anything
obvious.




More information about the R-help mailing list