chisqFunc: Format for printing p-value from Chi-square or Fisher exact...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/chisqFunc.R

Description

Meant to be used in creating R matrix to be exported as a table

Usage

1
chisqFunc(data, fvar, gvar, fisher = FALSE)

Arguments

data

Data frame where nvar and gvar can be found

fvar

Character string of column in data of factor data

gvar

Character string of column in data of grouping data

fisher

Logical whether to use Fisher exact test or chi-square

Details

If the p-value is less than 0.0005 then '< 0.001' is returned otherwise p-value rounded to 3 decimals is returned

Value

Returns a string of the p-value from a Chi-square test or Fisher exact test

Author(s)

University of Wisconsin-Madison Biostatistics and Medical Informatics Department, Scott Hetzel M.S.

See Also

tableFunc

Examples

1
2
3
4
5
6
set.seed(784)
outcome <- factor(sample(c("No", "Yes"), replace = TRUE, size = 20))
group <- factor(rep(c("A", "B"), each = 10))
d.frame <- data.frame(outcome, group)

chisqFunc(d.frame, "outcome", "group", fisher = TRUE)

jbirstler/biostatrpts documentation built on May 7, 2020, 12:10 a.m.