Description Usage Arguments Details Value Author(s) References Examples
View source: R/print_fisher_text.R
Print the results of a chi-square test
1 | print_fisher_text(data, x, y, var1_name, var2_name)
|
x |
A contingency table (passed as |
es |
Boolean. Should the phi coefficient be printed as a measure of effect size. See details. |
correct |
Boolean. Apply a continuity correction? See
|
decimals |
How many decimals should be printed |
decimals_p |
How many decimals should be printed for the p-value (defaults to 3) |
The argument es
only has an effect if x
is passed as a 2x2
contingency table. In this case, the phi coefficient is computed as
a measure of effect size (see Cohen, 1988, page 223).
A string describing the results of the chi-square test to be printed in Rmarkdown documents.
Martin Papenberg martin.papenberg@hhu.de
Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). Hillsale, NJ: Lawrence Erlbaum.
1 2 3 4 5 6 7 8 9 10 11 | # Pass a matrix
x <- matrix(c(12, 5, 7, 7), ncol = 2)
print_chi2(x) # does not use continuity correction by default
print_chi2(x, correct = TRUE) # uses continuity correction
# Pass a table
tab <- table(rbinom(150, 1, 0.5), rbinom(150, 1, 0.1))
print_chi2(tab, correct = FALSE)
# Pass a chi-squared test object
print_chi2(chisq.test(tab, correct = FALSE))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.