Skip to contents

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().

Usage

fisher.test(x, ...)

# S3 method for default
fisher.test(x, y = NULL, ...)

# S3 method for tabyl
fisher.test(x, ...)

Arguments

x

A two-way tabyl, a numeric vector or a factor

...

Parameters passed to stats::fisher.test()

y

if x is a vector, must be another vector or factor of the same length

Value

The same as the one of stats::fisher.test().

Examples

tab <- tabyl(mtcars, gear, cyl)
fisher.test(tab)
#> 
#> 	Fisher's Exact Test for Count Data
#> 
#> data:  tab
#> p-value = 8.26e-05
#> alternative hypothesis: two.sided
#>