Dear R-community,

Using bwplot, how can I put the whiskers at percentile 5 and percentile 95,
in place of the default position coef=1.5??

Using panel=panel.bwstrip, whiskerpos=0.05, from the package agsemisc gives
satisfaction, but changes the appearance of my boxplot and works with an old
version of R, what I don’t want, and I didn’t find the option in
box.umbrella parameters
Many thanks
Christophe

Here is the code:

library(lattice)
ex <- data.frame(v1 = log(abs(rt(180, 3)) + 1),
                 v2 = rep(c("2007", "2006", "2005"), 60),
                 z  = rep(c("a", "b", "c", "d", "e", "f"), e = 30))

ex2 <- data.frame(v1b = log(abs(rt(18, 3)) + 1),
                 v2 = rep(c("2007", "2006", "2005"), 6),
                 z  = rep(c("a", "b", "c", "d", "e", "f"), e = 3))
ex3 <- merge(ex, ex2, by=c("v2","z"))
D2007 <- ex3[ex3$z=="d" & ex3$v2==2007, ]
D2006 <- ex3[ex3$z=="d" & ex3$v2==2006, ]
C2007 <- ex3[ex3$z=="c" & ex3$v2==2007, ]
quantile(D2007$v1, probs = c(0.05, 0.95))
quantile(D2006$v1, probs = c(0.05, 0.95))
quantile(C2007$v1, probs = c(0.05, 0.95))

bwplot(v2 ~ v1 | z, data = ex3, layout=c(3,2), X = ex3$v1b,
pch = "|",
par.settings = list(
plot.symbol = list(alpha = 1, col = "transparent",cex = 1,pch = 20)),
panel = function(x, y, ..., X, subscripts){
 panel.grid(v = -1, h = 0)
 panel.bwplot(x, y, ..., subscripts = subscripts)
 X <- X[subscripts]
 xmax =max(x)
 X <- tapply(X, y, unique)
 Y <- tapply(y, y, unique)
 tg <- table(y)
 panel.points(X, Y, cex=3, pch ="|" , col = "red")
 #vcount <- tapply(v1, v2, length)
 panel.text((xmax-0.2), (Y-0.15), labels = paste("N=", tg))
 })

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to