Hi,

I'd like to add, say, the sample size for every group in a bwplot as a
parenthetical annotation to the axis.  Here's a sketch:

--8<---------------cut here---------------start------------->8---
require(Hmisc)
age <- sample(1:100, 1000, replace = TRUE)
sex <- gl(2, 8, 1000, c("Male", "Female"))
grp <- gl(4, 6, 1000, letters[1:4])

bwplot(grp ~ age | sex, aspect = 0.5, box.ratio = 2,
       panel = function(x, y, ...) {
         panel.bpplot(x, y, nout = 0.01, probs = seq(0.05, 0.45, 0.05))
         nage <- tapply(age, grp, length)
         panel.text(rep(0, length(x)), seq(along = x), labels = nage)
       })
--8<---------------cut here---------------end--------------->8---

I have two problems here: 1. place the sample size as a note in
parenthesis next to axis annotation label for the group (e.g. a (252), b
(252), c (250), d (246)), and 2. handle more complex subsetting in the
call to bwplot, i.e. when using the 'data' and 'subset' arguments, so that
'nage' in the code above is more flexible.  I have a feeling the
'subscripts' argument may be useful for the second issue, but I'm not
discovering how.  For the first point, I'll have to play some more with
'scales' argument and its 'at' and 'labels' components.

Any suggestions?

Thanks in advance,


-- 
Sebastian P. Luque

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to