Learn R Programming

vcd (version 0.9-0)

spineplot: Spineplots

Description

Spine plots are special cases of mosaic plots, spineplot is a convenience interface to mosaic.

Usage

spineplot(x, ...)
## S3 method for class 'default':
spineplot(x, split_vertical = TRUE, ...)
## S3 method for class 'formula':
spineplot(formula, data = list(), cut = NULL,  ...)

Arguments

x
an object, the default method covers all cases covered by mosaic.
formula
a "formula" of type y ~ x with a single dependent "factor" and a single explanatory variable. Alternatively, this can be a "table" object.
split_vertical
logical. Contrary to the settings in mosaic, the default is to start with a vertical split.
data
an optional data frame (only used if formula is a formula).
cut
if x is a numeric variable, it is cut into a factor at these points, by default set to fivenum(x).
...
additional arguments passed to mosaic.

Value

  • The structable visualized is returned invisibly.

Details

spineplot is a simple convenience interface to mosaic which uses a different default for the splitting direction. It is aimed at simple explanatory models like y ~ x where x can be either a factor or a numeric which is cut to a factor.

See Also

mosaic

Examples

Run this code
## Arthritis data (dependence on a categorical variable)
data(Arthritis)
(spineplot(Improved ~ Treatment, data = Arthritis))

## Space shuttle data (dependence on a numerical variable)
data(SpaceShuttle)
(spineplot(Fail ~ Temperature, data = SpaceShuttle))

Run the code above in your browser using DataLab