Computes the complete disjunctive table of a factor table.
Usage
cdt(object, ...)
# S4 method for class 'matrix'
cdt(object, exclude = NULL, abbrev = TRUE)
# S4 method for class 'data.frame'
cdt(object, exclude = NULL, abbrev = TRUE)Arguments
- object
- A - data.frame.
- ...
- Currently not used. 
- exclude
- A - vectorof values to be excluded when forming the set of levels (see- factor()). If- NULL(the default), will make- NAan extra level.
- abbrev
- A - logicalscalar: should the column names be abbreviated? If- FALSE, these are of the form 'factor_level' but if- abbrev = TRUEthey are just 'level' which will suffice if the factors have distinct levels.
Value
A data.frame.
See also
Other tools:
burt()
Examples
## Create a factor table
x <- data.frame(
  A = c("a", "b", "a"),
  B = c("x", "y", "z")
)
## Complete disjunctive table
cdt(x)
#>      a b x y z
#> [1,] 1 0 1 0 0
#> [2,] 0 1 0 1 0
#> [3,] 1 0 0 0 1
## Burt table
burt(x)
#>   a b x y z
#> a 2 0 1 0 1
#> b 0 1 0 1 0
#> x 1 0 1 0 0
#> y 0 1 0 1 0
#> z 1 0 0 0 1
