[R] How to produce notches in bwplot?

Deepayan Sarkar deepayan.sarkar at gmail.com
Sun Feb 26 22:04:00 CET 2006


On 2/26/06, Michael Kubovy <kubovy at virginia.edu> wrote:
> Dear r-helpers,
>
> tst <- data.frame(as.numeric(x <- 1:20), f <- rep(c('hi','lo'), times
> = 10))
> with(tst, bwplot(f ~ x, panel = function(x, y){panel.bwplot(x, y, pch
> = '|', stats = boxplot.stats, fill = 8, varwidth = T)}))
>
> I can't figure out from the documentation how to tell stats that I
> would like to see notches or (even bands).
>
> Here is what I've done. (By the way, there is something about the
> style of R documentation that has --- more than once --- led me to
> these kinds of problems.)
> RSiteSearch('bwplot notch') gives me nothing (as well as other
> similar queries).
> xyplot {lattice} tells me about panel.bwplot, but does not illustrate
> its use.

Well, ?xyplot, which is the same as ?bwplot, does give you examples of
calls to bwplot. If you want, you can imagine adding
'panel=panel.bwplot' to that call (which is redundant because that's
the default). I'm not sure what other ``illustrative use'' you were
hoping for.

> panel.bwplot {lattice} tells me about the fact that the default
> setting of stats to boxplot.stats, but doesn't give an example.
> boxplot.stats {grDevices}  tells me that the default setting is
> do.conf = TRUE, which I gathered meant that notches would be computed
> and hence plotted.
>
> Does anyone have advice about how I could have gone about finding out
> how to do this (preferably from documentation rather than reading code)?

You cannot add notches using the default panel function for bwplot,
i.e. panel.bwplot. Since you found no indication in the documentation
that you could, I would say that the documentation was successful :-).

It's hard enough documenting features that are available, so you can't
really expect a list of features that are not implemented. This case
is somewhat unusual, since this is a feature available in boxplot but
missing in panel.bwplot, so I'll add a note.

Of course, you can always write your own panel function that implements notches.

Deepayan
--
http://www.stat.wisc.edu/~deepayan/




More information about the R-help mailing list