This generic function overrides stats::fisher.test. If the passed table is a two-way tabyl, it runs it through janitor::fisher.test.tabyl, otherwise it just calls stats::fisher.test.
fisher.test(x, ...)# S3 method for default
fisher.test(x, y = NULL, ...)
# S3 method for tabyl
fisher.test(x, ...)
a two-way tabyl, a numeric vector or a factor
other parameters passed to stats::fisher.test
if x is a vector, must be another vector or factor of the same length
The result is the same as the one of stats::fisher.test.
# NOT RUN {
tab <- tabyl(mtcars, gear, cyl)
fisher.test(tab)
# }
Run the code above in your browser using DataLab