chisq_pval | R Documentation |
P-value of chi-squared contingency table test
chisq_pval(y, g, pvdigits = 4)
y |
A numeric vector (or factor). Row variable in contingency table. |
g |
A numeric vector (or factor). Column variable in contingency table. |
pvdigits |
number of digits for the p-value |
If conditions for the validity of chi squared test are not met (expected frequencies less than 5) a Fisher exact test is performed instead.
p-value of the chi squared contingency table test chisq.test(table(y,g))
df <- data.frame(g=rbinom(100,4,0.5),y=rnorm(sample(c(1:2),100,replace=TRUE)))
chisq_pval(df$y,df$g,pvdigits=3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.