bwplot(){lattice}

The bwplot() function can be found in . Variables are specified using lattice specific .

- bwplot(infmor,data=world)
A simple boxplot for infmor
(A single variable specified).
Note that
bwplot(infmor) produces the same boxplot
*if*you have previously issued a attach(world). span class="code">bwplot() accepts only individual variables (vectors) you cannot specify a matrix.
li>bwplot(infmor ~ continent, data=world) boxplot by continent
(the categorical variable continent defines the groups)
- bwplot(infmor ~ continent | equal.count(urb,3), data=world) produce a boxplot for variable infmor by continent for three distinct levels of urbanization. equal.count(urb,3) is a lattice function that creates a categorical variable (factor) from a continuous variable, with roughly the same number of observations. Here three groups are created..
- bwplot(infmor ~ continent | equal.count(urb,3)*equal.count(gnpcap,3), data=world)
adds a second condition (gnpcap GNP/Capita in three groups.

Note that in the example the chart titles contain in addition to the title, the interval covered by the groups using colour.:

bwplot is in fact an interface to panel.bwplot a function that describes how to produce the individual graphs. The collection of functions made available offers a very large number of options that are beyond the scope of this text; let us just say that most of the options are dealing with aesthetical aspects (colours, styles etc) of the charts or let add titles and labels.

See also

- Boxplots
- Variations of boxplots
- Creating groups Learn to create categorical variables from continuous variables
- [ggplot2] qplot(continent,urb, geom="boxplot") produces also boxplots by continents.