The R Project SVN R

Rev

Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 48
Line 1... Line 1...
1
\name{boxplot}
1
\name{boxplot}
2
\title{Box Plots}
2
\title{Box Plots}
3
\usage{
3
\usage{
4
boxplot(\dots, range=1.5, width, varwidth=FALSE,
4
boxplot(\dots, range = 1.5, width = NULL, varwidth = FALSE,
5
        notch=FALSE, names, data, plot=TRUE, col=NULL,
5
        notch = FALSE, names, data = sys.frame(sys.parent()),
-
 
6
        plot = TRUE, border = par("fg"), col = NULL, log = "",
6
        border=par("fg"))
7
        pars = NULL)
7
}
8
}
8
\alias{boxplot}
9
\alias{boxplot}
9
\arguments{
10
\arguments{
10
\item{\dots}{the data from which the boxplots are to be produced.
11
  \item{\dots}{the data from which the boxplots are to be produced.  The
11
The data can be specified as separate vectors, each corresponding
12
    data can be specified as separate vectors, each corresponding to a
12
to a component boxplot, or as a single list containing such vectors.
13
    component boxplot, or as a single list containing such vectors.
13
Alternatively a symbolic specification of the form
14
    Alternatively a symbolic specification of the form \code{x ~ g} can
14
\code{x ~ g} can be given, indicating the the observations
15
    be given, indicating the the observations in the vector \code{x} are
15
in the vector \code{x} are to be grouped according to
16
    to be grouped according to the levels of the factor \code{g}.  In
16
the levels of the factor \code{g}.  In this case the argument
-
 
17
\code{data} can be used to provide values for the variables
17
    this case the argument \code{data} can be used to provide values for
18
in the specification.
18
    the variables in the specification. 
19
\code{NA}s are allowed in the data.}
19
    \code{NA}s are allowed in the data.}
20
\item{range}{this determines how far the plot whiskers
20
  \item{range}{this determines how far the plot whiskers extend out from
21
extend out from the box.
-
 
22
If \code{range} is positive, 
21
    the box.  If \code{range} is positive, the whiskers extend to the
23
the whiskers extend to the most extreme data point which
-
 
24
is no more than \code{range} times the interquartile range
22
    most extreme data point which is no more than \code{range} times the
25
from the box.
23
    interquartile range from the box.
26
A value of zero causes the whiskers to extend to the data extremes.}
24
    A value of zero causes the whiskers to extend to the data extremes.}
27
\item{width}{a vector giving the relative widths of the boxes
25
  \item{width}{a vector giving the relative widths of the boxes making
28
making up the plot.}
26
    up the plot.} 
29
\item{varwidth}{if \code{varwidth} is \code{TRUE}, the boxes
27
  \item{varwidth}{if \code{varwidth} is \code{TRUE}, the boxes are drawn
30
are drawn with widths proportional to the square-roots
28
    with widths proportional to the square-roots of the number of
31
of the number of observations in the groups.}
29
    observations in the groups.} 
32
\item{notch}{if \code{notch} is \code{TRUE}, a notch is drawn in each
30
  \item{notch}{if \code{notch} is \code{TRUE}, a notch is drawn in each
33
side of the boxes.  If the notches of two plots do not
31
    side of the boxes.  If the notches of two plots do not overlap then
34
overlap then the medians are significantly different at the
32
    the medians are significantly different at the 5 percent level.}
35
5 percent level.}
-
 
36
\item{name}{group labels which while be printed under
33
  \item{names}{group labels which while be printed under each boxplot.}
37
each boxplot.}
34
  \item{data}{???}
38
\item{plot}{if \code{plot} is \code{TRUE} (the default) then
35
  \item{plot}{if \code{TRUE} (the default) then a boxplot is produced.  
39
a boxplot is produced.
-
 
40
If not, the summaries which the boxplots are based on are
36
    If not, the summaries which the boxplots are based on are returned.}
41
returned.}
-
 
42
\item{border}{an optional vector of colors for the outlines of
37
  \item{border}{an optional vector of colors for the outlines of the
43
the boxplots.  The values in \code{border} are recycled if
38
    boxplots.  The values in \code{border} are recycled if the length of
44
the length of \code{border} is less than the number of plots.}
39
    \code{border} is less than the number of plots.} 
45
\item{col}{if \code{col} is non-null it is assumed to
40
  \item{col}{if \code{col} is non-null it is assumed to contain colors
46
contain colors to be used to col the bodies of the box plots.}
41
    to be used to col the bodies of the box plots.}
-
 
42
  \item{log}{???}
-
 
43
  \item{pars}{???}
47
\item{\dots}{graphical parameters can also be passed as
44
  \item{\dots}{graphical parameters can also be passed as arguments to
48
arguments to \code{boxplot}.}
45
    \code{boxplot}.}
49
}
46
}
50
\value{
47
\value{
51
This function is usually invoked for its side effect
48
  This function is usually invoked for its side effect which is to
52
which is to produce box-and-whisker plots of the given values.
49
  produce box-and-whisker plots of the given values.  However, it also
53
However, it also returns a list with one component corresponding
50
  returns a list with one component corresponding to each plot.  The
54
to each plot.  The components are themselves lists with named components
51
  components are themselves lists with named components as follows:
55
as follows: 
-
 
56
\item{stats}{a vector containing the extreme of the
52
  \item{stats}{a vector containing the extreme of the lower whisker, the
57
lower whisker, the lower hinge, the median, the upper hinge
53
    lower hinge, the median, the upper hinge and the extreme of the
58
and the extreme of the upper whisker.}
54
    upper whisker.}
59
\item{n}{the number of observations in the sample.}
55
  \item{n}{the number of observations in the sample.}
60
\item{conf}{the lower and upper extremes of the notch.}
56
  \item{conf}{the lower and upper extremes of the notch.}
61
\item{out}{the values of any data points which lie beyond the
57
  \item{out}{the values of any data points which lie beyond the extremes
62
extremes of the whiskers.}
58
    of the whiskers.}
63
}
59
}
64
\seealso{
60
\seealso{
65
\code{\link{boxplot.stats}} which does the computation and
61
  \code{\link{boxplot.stats}} which does the computation,
66
\code{\link{bxp}} for the plotting.
62
  \code{\link{bxp}} for the plotting.
67
}
63
}
68
\examples{
64
\examples{
69
data(insects)
65
data(insects)
70
boxplot(count~spray, data=insects, col="lightgray")
66
boxplot(count ~ spray, data = insects, col = "lightgray")
71
}
67
}