View source: R/rp_contingency.R
| rp.contingency | R Documentation |
A two-way contingency table is displayed graphically and the uncertainties associated with a chi-squared test may be visualised.
rp.contingency(x, uncertainty = 'none', proportion.scale = 'fixed', cols)
x |
a two-way table or matrix of observed counts. |
uncertainty |
a character value which controls whether uncertainties are displayed for each cell, in |
proportion.scale |
a character value specifying whether the proportion scale is |
cols |
a named vector of characters specifying colours to be used in the plot. See |
The table is displayed in a form which stratifies by columns. If it more appropriate to stratify by the rows of x then the function may be applied to t(x).
The uncertainties associated with each cell are based on the standard errors associated with standardised residuals. See the help file for chisq.test for details.
Missing data are not allowed.
## Not run:
x <- matrix(c(19, 41, 32, 28), ncol = 2,
dimnames = list(c("non-smoker", "smoker"),
c("cases", "controls")))
rp.contingency(x)
rp.contingency(x, style = "aligned")
rp.contingency(x, uncertainty = TRUE)
rp.contingency(x, uncertainty = TRUE) + ggplot2::coord_flip()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.