DescTools (version 0.99.11)

Desc.table: Describe a n-dimensional Contingency Table

Description

A 2-dimensional table will be described with it's relative frequencies, a short summary containing the total cases, the dimensions of the table, chi-square tests and some association measures as phi-coefficient, contingency coefficient and Cramer's V. Tables with higher dimensions will simply be printed as flat table, with marginal sums for the first and for the last dimension.

Usage

## S3 method for class 'table':
Desc(x, main = NULL, rfrq = NULL, 
     margins = c(1, 2), plotit = getOption("plotit", FALSE), 
     verbose = c("medium","low","high"), ...)
     
## S3 method for class 'matrix':
Desc(x, main = NULL, rfrq = NULL,  
     margins = c(1,2), plotit = getOption("plotit", FALSE), 
     verbose = c("medium","low","high"), ...)

Arguments

x
a n-dimensional table or matrix
main
the main caption for the output.
rfrq
a string with 3 characters, each of them being 1 or 0, defining which percentages should be reported. The first position is interpreted as total percentages, the second as row percentages and the third as column percentages
margins
a vector, consisting out of 1 and/or 2. Defines the margin sums to be included. Row margins are reported if margins is set to 1. Set it to 2 for column margins and c(1,2) for both. Default is NULL (none).
plotit
logical. Should a plot be created? The table will be plotted by PlotDesc.table, which creates two mosaicplots. Default is FALSE.
verbose
character defining the verbosity of the reported results. One out of c("medium", "low", "high"), "medium" being the default. Can be abbreviated.
...
the dots are passed to the function PercTable, allowing to set futher arguments like expected values etc.

Value

  • no results are returned.

Details

Note that NAs cannot be handled by this interface, as tables in general come in "as.is", say basically as a matrix without any further information about potentially previously cleared NAs.

See Also

Desc.logical, Desc.factor, Desc.ordered, Desc.integer, Desc.numeric, Desc.Date, Desc.table, Desc.data.frame, Desc.formula PercTable

Examples

Run this code
Desc(table(d.pizza$driver, Weekday(d.pizza$date)), rfrq="100", plotit=TRUE)

tab <- as.matrix(read.table(text="549 212  54
   93 124  54
  233  78  33
  119  42  13
  225  41  46
  455  12   7
  402 132 153"
))

tab

# taciturn ("Ripley style")
Desc(tab, verbose="low")  

# talkative  
Desc(tab, verbose="high", expected=TRUE, res=TRUE)

# higher dimensional tables
Desc(Titanic)

Run the code above in your browser using DataCamp Workspace