infer_chisq()
creates a tidy summary table for results of a chi-squared test. Alternatively, you can
select to see expected counts (type = "expected"
) or observed counts (type = "observed"
).
Usage
infer_chisq(
data,
formula,
type = c("test", "expected", "observed"),
digits = 3,
caption = NULL
)
Arguments
- data
A data frame (or tibble).
- formula
The variable to run the test on, in formula syntax,
~var
.- type
The kind of output to receive. Valid options are either "test" (the default), "expected", or "observed".
- digits
The number of digits to round table values to. Defaults to 3.
- caption
An override to the table caption. A sensible default is provided.
Examples
suppressWarnings(infer_chisq(mtcars, cyl~gear))
#> Note: NAs always removed for chi squared tests.
#> This message is displayed once per session.
suppressWarnings(infer_chisq(mtcars, cyl~gear, type = "expected"))
suppressWarnings(infer_chisq(mtcars, cyl~gear, type = "observed"))