Hi R-helpers, I have a data.frame with three columns (lots more reps though in each), like so: 'FOO' 'BAR' 'RESULT' 1 .01 75 1 .05 12 1.1 .01 100 1.1 .05 50 1.2 .01 75 1.2 .05 12 I am calling boxplot(RESULT ~ FOO:BAR, ...) This gives me the box plots I want, but on the x-axis my labels are "1.01", "1.05", "1.1.01", "1.1.05", "1.2.01", "1.2.01". I would like to separate the factors by something other than a dot for obvious reasons. I would also like to *avoid* using the 'names' parameter to boxplot (because I am lazy and want a general solution). Please cc me directly as I read the list on digest Thanks again to such a helpful list! W
Gabor Grothendieck
2004-Apr-29 11:16 UTC
[R] label separators in boxplots with conditioning
Webb Sprague <wwsprague <at> ucdavis.edu> writes: : : Hi R-helpers, : : I have a data.frame with three columns (lots more reps though in each), : like so: : : 'FOO' 'BAR' 'RESULT' : 1 .01 75 : 1 .05 12 : 1.1 .01 100 : 1.1 .05 50 : 1.2 .01 75 : 1.2 .05 12 : : I am calling boxplot(RESULT ~ FOO:BAR, ...) This gives me the box plots : I want, but on the x-axis my labels are "1.01", "1.05", "1.1.01", : "1.1.05", "1.2.01", "1.2.01". I would like to separate the factors by : something other than a dot for obvious reasons. I would also like to : *avoid* using the 'names' parameter to boxplot (because I am lazy and : want a general solution). 1. Assuming BAR is numeric and always positive and the data frame is z, this will insert a minus sign giving you some separation: boxplot(RESULT~FOO:I(-BAR),data=z) 2. You could consider replacing BAR with something along the lines of: z$BAR <- factor(paste("(",z$BAR,")",sep=""))