Learn R Programming

vcd (version 0.9-0)

spacings: Spacing-generating Functions

Description

These functions generate spacing functions to be used with strucplot to obtain customized spaces between the elements of a strucplot.

Usage

spacing_equal(sp = unit(0.5, "lines"))
spacing_dimequal(sp)
spacing_increase(start = unit(0.3, "lines"), rate = 1.5)
spacing_conditional(sp = unit(0.5, "lines"), start = unit(2, "lines"), rate = 1.8)
spacing_doubledecker(start = unit(0.3, "lines"), rate = 1.8)

Arguments

start
object of class "unit" indicating the start value for increasing spacings.
rate
increase rate for spacings.
sp
object of class "unit" specifying a fixed spacing.

Value

  • A spacing function with arguments:
  • d"dim" attribute of a contingency table.
  • condvarsindex vector of conditioning dimensions (only used by spacing_conditional and spacing_doubledecker.
  • This function computes a list of objects of class "unit". Each list element contains the spacing information for the corresponding dimension of the table. The length of the "unit" objects is $k-1$, $k$ number of levels of the corresponding factor.

Details

These generating functions return a function used by strucplot to generate appropriate spaces between tiles of a strucplot, using the dimnames information of the visualized table.

spacing_equal allows to specify one fixed space for all dimensions.

spacing_dimequal allows to specify a fixed space for each dimension.

spacing_increase creates increasing spaces for all dimensions, based on a starting value and an increase rate.

spacing_conditional combines spacing_equal and spacing_increase to create fixed spaces for conditioned dimensions, and increasing spaces for conditioning dimensions.

spacing_doubledecker is essentially spacing_conditional but with the space of the last dimension to 0 as needed for doubledecker.

See Also

strucplot, doubledecker

Examples

Run this code
strucplot(Titanic, spacing = spacing_increase(start = 0.5, rate = 1.5))
strucplot(Titanic, spacing = spacing_equal(1))
strucplot(Titanic, spacing = spacing_dimequal(1:4 / 4))
data(PreSex)
strucplot(aperm(PreSex, c(1,4,2,3)), spacing = spacing_conditional,
          condvars = 2)

Run the code above in your browser using DataLab