EVOLUTION-MANAGER
Edit File: chisq.test.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Apply stats::chisq.test to a two-way tabyl</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for chisq.test {janitor}"><tr><td>chisq.test {janitor}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Apply stats::chisq.test to a two-way tabyl</h2> <h3>Description</h3> <p>This 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. </p> <h3>Usage</h3> <pre> chisq.test(x, ...) ## Default S3 method: chisq.test(x, y = NULL, ...) ## S3 method for class 'tabyl' chisq.test(x, tabyl_results = TRUE, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>a two-way tabyl, a numeric vector or a factor</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>other parameters passed to stats::chisq.test</p> </td></tr> <tr valign="top"><td><code>y</code></td> <td> <p>if x is a vector, must be another vector or factor of the same length</p> </td></tr> <tr valign="top"><td><code>tabyl_results</code></td> <td> <p>if TRUE and x is a tabyl object, also return 'observed', 'expected', 'residuals' and 'stdres' as tabyl</p> </td></tr> </table> <h3>Value</h3> <p>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. </p> <h3>Examples</h3> <pre> tab <- tabyl(mtcars, gear, cyl) chisq.test(tab) chisq.test(tab)$residuals </pre> <hr /><div style="text-align: center;">[Package <em>janitor</em> version 2.1.0 <a href="00Index.html">Index</a>]</div> </body></html>