View source: R/txt_chisquare_report.R
txt_chisquare_report | R Documentation |
This function returns html formatted text summary of a Chi-sqauare test. The input object must be a chisq.test object, and the p-value is formatted by the 'htmlTable::txtPval()' function.
txt_chisquare_report(chisquare_object)
chisquare_object |
A Chi-square object |
txtPval
, sprintf
, chisq.test
library(htmlTable)
# a basic 2x2 table
table(mtcars$vs,mtcars$cyl) # the table
cstest1 <-chisq.test(table(mtcars$vs,mtcars$am)) # the chi.square test object
htmlTable::htmlTable(txt_chisquare_report(cstest1))
# a 2x3 table
table(mtcars$vs,mtcars$cyl)
cstest2 <-chisq.test(table(mtcars$vs,mtcars$cyl))
htmlTable::htmlTable(txt_chisquare_report(cstest2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.