View source: R/statistical_tests.R
| chisq.test | R Documentation |
stats::chisq.test() to a two-way tabylThis generic function overrides stats::chisq.test. If the passed table
is a two-way tabyl, it runs it through janitor::chisq.test.tabyl, otherwise
it just calls stats::chisq.test().
chisq.test(x, ...)
## Default S3 method:
chisq.test(x, y = NULL, ...)
## S3 method for class 'tabyl'
chisq.test(x, tabyl_results = TRUE, ...)
x |
a two-way tabyl, a numeric vector or a factor |
... |
other parameters passed to |
y |
if x is a vector, must be another vector or factor of the same length |
tabyl_results |
If |
The result is the same as the one of stats::chisq.test().
If tabyl_results is TRUE, the returned tables observed, expected,
residuals and stdres are converted to tabyls.
tab <- tabyl(mtcars, gear, cyl)
chisq.test(tab)
chisq.test(tab)$residuals
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.