mosaicplot               package:base               R Documentation

_M_o_s_a_i_c _P_l_o_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     Plots a mosaic on the current graphics device.

_U_s_a_g_e:

     mosaicplot(x, ...)
     mosaicplot.default(X, main = NULL, xlab = NULL, ylab = NULL,
                        sort = NULL, off = NULL, dir = NULL,
                        color = FALSE)
     mosaicplot.formula(formula, data = NULL, subset, na.action, ...)

_A_r_g_u_m_e_n_t_s:

       x: an R object.

       X: a contingency table, with optional category labels specified
          in the `dimnames(x)' attribute.  The table is best created by
          the `table()' command, which produces an object of type
          array.

    main: character string for the mosaic title.

xlab,ylab: x- and y-axis labels; by default, `names(dimnames(X))'.

    sort: vector ordering of the variables, containing a permutation of
          the integers `1:length(dim(x))' (the default).

     off: vector of offsets to determine percentage spacing at each
          level of the mosaic (appropriate values are between 0 and 20,
          and the default is 10 at each level).  There should be one
          offset for each dimension of the contingency table.

     dir: vector of split directions (`"v"' for vertical and `"h"' for
          horizontal) for each level of the mosaic, one direction for
          each dimension of the contingency table.  The default
          consists of alternating directions, beginning with a vertical
          split.

   color: (`TRUE' or vector of integer colors) for color shading or
          (`FALSE', the default) for empty boxes with no shading.

 formula: a formula, such as `y ~ x'.

    data: a data.frame (or list) from which the variables in `formula'
          should be taken.

  subset: an optional vector specifying a subset of observations to be
          used in the fitting process.

na.action: a function which indicates what should happen when the data
          contain `NA's.

     ...: further arguments to the default mosaicplot method.

_D_e_t_a_i_l_s:

     This is a generic function.  It currently has a default method
     (`mosaicplot.default') and a formula interface
     (`mosaicplot.formula').

     See Emerson (1998) for more information and a case study with
     television viewer data from Nielsen Media Research.

_A_u_t_h_o_r(_s):

     S-PLUS original by John Emerson emerson@stat.yale.edu. Slightly
     modified for R by KH.

_R_e_f_e_r_e_n_c_e_s:

     Hartigan, J.A., and Kleiner, B. (1984) A mosaic of television
     ratings. The American Statistician, 38, 32-35.

     Emerson, J. W. (1998) Mosaic displays in S-PLUS: a general
     implementation and a case study. Statistical Computing and
     Graphics Newsletter (ASA), 9, 1, 17-23.

     Friendly, M. (1994) Mosaic displays for multi-way contingency
     tables. Journal of the American Statistical Association, 89,
     190-200.

     The home page of Michael Friendly (<URL:
     http://hotspur.psych.yorku.ca/SCS/friendly.html>) provides
     information on various aspects of graphical methods for analyzing
     categorical data, including mosaic plots.

_E_x_a_m_p_l_e_s:

     data(Titanic)
     mosaicplot(Titanic, main = "Survival on the Titanic", color = TRUE)

     ## Formula interface: visualize crosstabulation of numbers of gears and
     ## carburettors in Motor Trend car data.
     data(mtcars)
     mosaicplot(~ gear + carb, data = mtcars, color = TRUE)

