\HeaderA{barchart.table}{table methods for barchart and dotplot}{barchart.table}
\aliasA{barchart.array}{barchart.table}{barchart.array}
\aliasA{barchart.matrix}{barchart.table}{barchart.matrix}
\aliasA{dotplot.array}{barchart.table}{dotplot.array}
\aliasA{dotplot.matrix}{barchart.table}{dotplot.matrix}
\aliasA{dotplot.table}{barchart.table}{dotplot.table}
\keyword{hplot}{barchart.table}
\begin{Description}\relax
Contingency tables are often displayed using barcharts and dotplots.
These methods are provided for convenience and operate directly on
tables.  Arrays and matrices are simply coerced to be a table.
\end{Description}
\begin{Usage}
\begin{verbatim}
## S3 method for class 'table':
barchart(x, data, groups = TRUE,
         origin = 0, stack = TRUE, ..., horizontal = TRUE)

## S3 method for class 'array':
barchart(x, data, ...)

## S3 method for class 'matrix':
barchart(x, data, ...)

## S3 method for class 'table':
dotplot(x, data, groups = TRUE, ...)

## S3 method for class 'array':
dotplot(x, data, ...)

## S3 method for class 'matrix':
dotplot(x, data, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] a \code{table}, \code{array} or \code{matrix} object.

\item[\code{data}] should not be specified. If specified, will be ignored with a
warning.

\item[\code{groups}] logical, whether to use the last dimension as the grouping variable
in the display.

\item[\code{origin, stack}] arguments to \code{panel.barchart} controlling the display.  The
defaults for the \code{table} method are diffrent.

\item[\code{horizontal}] logical, indicating whether the bars should be
horizontal or vertical

\item[\code{...}] other arguments, passed to the underlying \code{formula}
method.

\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The first dimension is used as the variable on the vertical axis.  The
last dimension is optionally used as a grouping variable (to produce
stacked barcharts by default).  All other dimensions are used as
conditioning variables.  The order of these variables cannot be
altered (except by permuting the original argument using
\code{\LinkA{t}{t}} or \code{\LinkA{aperm}{aperm}}).  For more flexibility, use
the formula method after converting the table to a data frame using
the relevant \code{\LinkA{as.data.frame}{as.data.frame}}
method.
\end{Details}
\begin{Value}
An object of class \code{"trellis"}. The
\code{\LinkA{update}{update}} method can be used to
update components of the object and the
\code{\LinkA{print}{print}} method (usually called by
default) will plot it on an appropriate plotting device.
\end{Value}
\begin{Author}\relax
Deepayan Sarkar \email{Deepayan.Sarkar@R-project.org}
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{barchart}{barchart}}, \code{\LinkA{t}{t}}, \code{\LinkA{aperm}{aperm}},
\code{\LinkA{table}{table}}, \code{\LinkA{panel.barchart}{panel.barchart}},
\code{\LinkA{Lattice}{Lattice}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
barchart(Titanic, scales = list(x = "free"),
         auto.key = list(title = "Survived"))
\end{ExampleCode}
\end{Examples}

