[R] displaying sample size in boxplots

Patrick Drechsler patrick.drechsler at gmx.net
Fri Oct 1 20:34:38 CEST 2004


Gregory R. Warnes wrote on 01 Oct 2004 14:52:05 MET:

[...]
>> > Here are the current proposals [for cut & paste]:
>> >
>> > library(ISwR)
>> > data(energy)
>> > attach(energy)
>> >
>> > ## 1
>> > boxplot(expend~stature)
>> > sample.size <- tapply(expend, stature, length)
>> > ss.ch <- paste("N=", sample.size, sep="")
>> > mtext(ss.ch, at=1:length(unique(stature)), line=2, side=1)
>> >
>> > ## 2 (Roger)
>> > boxplot(expend~stature, width=sample.size/length(expend),
>> >         names=paste(levels(stature), ", N=", sample.size, sep=""))
>> >
>> > ## 3 (Roger + Martin):
>> > boxplot(expend ~ stature, varwidth= TRUE,
>> >         names=paste(levels(stature), ", N=", sample.size, sep=""))
[...]

> Also note that boxplot.n in the gplots library (part of the
> gregmisc bundle) automatically adds the number of observations.

Thanks Greg! Nice to see that you've written some code just for
this purpose. I will of course also take a closer look at the
other functions that are bundled in `gregmisc'.

Since I'm still new to R: can somebody give me a pointer to the
docs where to find instructions on a package (not a function)? I
can find the man pages to specific functions with ?<functionname>
(something similar to `texdoc <packagename>' in tetex)?

TIA,

Patrick
-- 
Look Ma, this man can twist his fingers as if they were made of
rubber, isn't that amazing? -- Not really, he's been using Emacs
for years...!




More information about the R-help mailing list