View source: R/epi_functions.R
contingency | R Documentation |
contingency
is a wrap that calls epi.2by2
from package epiR
.
contingency(
object = NULL,
formula = NULL,
data = NULL,
method = "cohort.count",
...
)
object |
When chaining, this holds an object produced in the earlier portions of the chain. Most users can safely ignore this argument. See details and examples. |
formula |
A formula with shape: outcome ~ exposure. |
data |
A data frame where the variables in the |
method |
A character string with options: "cohort.count", "cohort.time", "case.control", or "cross.sectional". |
... |
Further arguments passed to |
contingency
uses a formula as a way to input variables.
contingency
displays the contingency table as a way for the user to check that the reference levels
in the categorical variables (outcome and exposure) are correct. Then displays measures of association
(table from epi.2by2
). It also reports either chi-squared
test or exact Fisher's test;
contingency
checks which one of the tests two is appropriate.
epi.2by2
.
## A case-control study on the effect of alcohol on oesophageal cancer.
Freq <- c(386, 29, 389, 171)
status <- gl(2, 1, 4, labels = c("Control", "Case"))
alcohol <- gl(2, 2, labels = c("0-39", "40+"))
cancer <- data.frame(Freq, status, alcohol)
cancer <- expand_df(cancer)
contingency(status ~ alcohol, data = cancer, method = "case.control")
data(Oncho)
require(dplyr, quietly = TRUE)
Oncho |>
select(mf, area) |>
cross_tbl(by = "mf") |>
theme_pubh(2)
Oncho |>
contingency(mf ~ area)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.