Structured Contingency Tables
This function produces a
## S3 method for class 'formula': structable(formula, data, direction = NULL, split_vertical = FALSE, \dots, subset, na.action) ## S3 method for class 'default': structable(\dots, direction = NULL, split_vertical = FALSE)
- a formula object with possibly both left and right hand sides specifying the column and row variables of the flat table.
- a data frame, list or environment containing the variables to be cross-tabulated, or a contingency table.
- an optional vector specifying a subset of observations
to be used.
datais a contingency table.
- a function which indicates what should happen when
the data contain
NAs. Ignored if
datais a contingency table
- Robjects which can be interpreted as factors (including
character strings), or a list (or data frame) whose components can
be so interpreted, or a contingency table object of class
- logical vector indicating, for each dimension,
whether it should be split vertically or not. Values are recycled
as needed. If the argument is of length 1, the value is alternated
for all dimensions.
- character vector alternatively specifying the
splitting direction (
"h"for horizontal and
"v"for vertical splits). Values are recycled as needed. If the argument is of length 1, the value is alternated for all dime
This function produces textual representations of mosaic displays, and
ftable, but also accepts the
mosaic-like formula interface (empty left-hand
side). Note that even if the
ftable interface is used,
direction argument is needed to
specify the order of the horizontal and vertical splits.
If pretabulated data with a
Freq column is used, than the
left-hand side should be left empty---the
Freq column will be
- An object inheriting from class
"ftable"with the splitting information (
"split_vertical") as additional attribute.
structable(Titanic) structable(Titanic, split_vertical = c(TRUE, TRUE, FALSE, FALSE)) structable(Titanic, direction = c("h","h","v","v")) structable(Sex + Class ~ Survived + Age, data = Titanic)