[R] french secondary boxplot
Earl F. Glynn
efg at stowers-institute.org
Fri Mar 17 18:03:25 CET 2006
>"Jean-Pierre GERBAL" <jean-pierre.gerbal at ac-orleans-tours.fr> wrote in
message
>news:105EFDC6-4AAE-49E1-BF00-1E5ABB96163F at ac-orleans-tours.fr...
>
>i'm a mathematic teacher and i have a question for R-developers :
>
>is it possible to have (in the future) a boxplot with whiskers from
>the first decile to the ninth decile, as usual in secondary french
>schools... by example : boxplot(serie,range=-1) for french boxplot ?
Perhaps you could use bxp and bp.stats to create your own version:
set.seed(19)
x <- rnorm(100)
oldpar <- par(mfrow=c(1,3))
# 1. "Normal" boxplot
boxplot.info <- boxplot(x, plot=FALSE)
boxplot.info
# compare boxplot.info$stats with deciles. Boxplot's normal
# limits are 0% and 100% quantiles.
deciles <- quantile(x, probs=seq(0,1,0.1))
deciles
bxp(boxplot.info, main="Normal boxplot", ylim=c(-3,3))
# 2. Modify boxplot.info to use 10% and 90% deciles instead of 0% and 100%
boxplot.info$stats[1] <- deciles["10%"]
boxplot.info$stats[5] <- deciles["90%"]
bxp(boxplot.info, main="10%/90% whiskers", ylim=c(-3,3))
# 3. Build your own, e.g, Mean +/- 1 and 2 standard deviations
boxplot.limits <- as.matrix(c(mean(x) - 2*sd(x),
mean(x) - sd(x),
mean(x),
mean(x) + sd(x),
mean(x) + 2*sd(x)))
boxplot.meansd <- list(stats = bp.limits,
n = length(len),
conf = NULL,
out = numeric(0))
bxp(boxplot.meansd, main=expression("mean" %+-% "1 and 2 SDs"),
ylim=c(-3,3))
par(oldpar)
efg
Earl F. Glynn
Stowers Insititute for Medical Research
More information about the R-help
mailing list