[R] displaying sample size in boxplots

Patrick Drechsler patrick.drechsler at gmx.net
Wed Sep 29 14:46:41 CEST 2004


Hi,

I was wondering if there is a ready made function or parameter
for indicating the sample size in boxplots?

Here's what I came up with so far:

library(ISwR)
data(energy)
attach(energy)
boxplot(expend~stature)
sample.size <- tapply(expend, stature, length)
sample.size <- paste("N=", sample.size, sep="")
mtext(sample.size, at=1:length(unique(stature)), line=2, side=1)

TIA,

Patrick
-- 
"What happens if a big asteroid hits Earth ? Judging from
 realistic simulations involving a sledge hammer and a common
 laboratory frog, we can assume it will be pretty bad."
                                                -- Dave Barry




More information about the R-help mailing list