Usage
## S3 method for class 'default':
mosaic(x, condvars = NULL,
split_vertical = NULL, direction = NULL, spacing = NULL,
spacing_args = list(), gp = NULL, expected = NULL, shade = NULL,
highlighting = NULL, highlighting_fill = grey.colors, highlighting_direction = NULL,
zero_size = 0.5, zero_split = FALSE, zero_shade = NULL,
zero_gp = gpar(col = 0), panel = NULL, main = NULL, sub = NULL, ...)
## S3 method for class 'formula':
mosaic(formula, data, highlighting = NULL,
\dots, main = NULL, sub = NULL, subset = NULL, na.action = NULL)
Arguments
x
a contingency table in array form, with optional category
labels specified in the dimnames(x)
attribute, or an object
of class "structable"
.
condvars
vector of integers or character strings indicating
conditioning variables, if any. The table will be permuted to order
them first.
formula
a formula specifying the variables used to create a
contingency table from data
. For convenience, conditioning
formulas can be specified; the conditioning variables will then be
used first for splitting. If any, a specified resp
data
either a data frame, or an object of class "table"
or "ftable"
.
subset
an optional vector specifying a subset of observations to be used.
na.action
a function which indicates what should happen when
the data contain NA
s. Ignored if data
is a contingency table.
zero_size
size of the bullets used for zero entries (if 0, no
bullets are drawn).
zero_split
logical controlling whether zero cells should be
further splitted. If FALSE
and zero_shade
is
FALSE
, only one bullet is drawn (centered) for unsplitted
zero cells. If FALSE
and zero_sha
zero_shade
logical controlling whether zero bullets should be
shaded. The default is TRUE
if shade
is TRUE
or expected
is not null or gp
is not null, and
FALSE
otherwise.
zero_gp
object of class "gpar"
used
for zero bullets in case they are not shaded.
split_vertical
vector of logicals of length $k$, where $k$
is the number of margins of x
(default: FALSE
).
Values are recycled as needed.
A TRUE
component indicates that the tile(s) of the
corresponding dimension s
direction
character vector of length $k$, where $k$ is the
number of margins of x
(values are recycled as needed).
For each component, a value of "h"
indicates that the tile(s)
of the corresponding dimension should be split hor
spacing
spacing object, spacing function, or corresponding
generating function (see strucplot
for more
information).
The default is spacing_equal
if x
has two dimensions,
spacing_args
list of arguments for the generating function, if
specified (see strucplot
for more information). gp
object of class "gpar"
, shading function or a
corresponding generating function (see details and
shadings
). Components of "gpar"
objects are recycled as needed along t shade
logical specifying whether gp
should be used or not
(see gp
). If TRUE
and expected
is unspecified,
a default model is fitted: if condvars
(see
expected
optionally, an array of expected values of the same dimension
as x
, or alternatively the corresponding independence model specification
as used by loglin
or
highlighting
character vector or integer specifying a variable
to be highlighted in the cells.
highlighting_fill
color vector or palette function
used for a highlighted variable, if any.
highlighting_direction
Either "left"
, "right"
,
"top"
, or "bottom"
specifying the direction of
highlighting in the cells.
panel
Optional function with arguments: residuals
,
observed
, expected
, index
, gp
, and
name
called by the
struc_mosaic
workhorse for each tile that is drawn in
main, sub
either a logical, or a character string used for plotting
the main (sub) title. If logical and TRUE
, the
name of the data
object is used.