Learn R Programming

DescTools (version 0.99.7)

Desc.table: Describe a contingency table

Description

A 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 phi-coefficient, contingency coefficient and Cramer's V as association measures.

Usage

## S3 method for class 'table':
Desc(x, xname = NULL, rfrq = NULL, 
           margins = c(1, 2), plotit = FALSE, verb = c("med","lo","hi"), ...)
## S3 method for class 'matrix':
Desc(x, xname = NULL, rfrq = NULL,  
            margins = c(1,2), plotit = FALSE, verb = c("med","lo","hi"), ...)

Arguments

x
a 2-dimensional table or a matrix
xname
the caption for the output.
rfrq
a string with 3 characters, each of them being 1 or 0. The first position means total percentages, the second means row percentages and the third column percentages. "011" produces a table output with row and column percentages. If set
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? Default is FALSE. The table would be plotted by PlotDesc.table.
verb
character defining the verbosity of the reported results. One out of c("med","lo","hi"), "med" being the default.
...
further argument to be passed to methods.

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 cleared NAs.

See Also

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

Examples

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


tab <- t(rbind(c(549,212,54),
           c(93,124,54),
           c(233,78,33),
           c(119,42,13),
           c(225,41,46),
           c(455,12,7),
           c(402,132,153)
     ))

# taciturn 
Desc(tab, verb="lo")  

# talkative  
Desc(tab, verb="hi", expected=TRUE, res=TRUE)

Run the code above in your browser using DataLab