Adds p-value to crosstab table
Calculate and add a p-value comparing the two variables in the cross table. Missing values are included in p-value calculations.
## S3 method for class 'tbl_cross' add_p(x, test = NULL, pvalue_fun = NULL, source_note = NULL, ...)
x |
Object with class |
test |
A string specifying statistical test to perform. Default is
" |
pvalue_fun |
Function to round and format p-value.
Default is style_pvalue, except when |
source_note |
Logical value indicating whether to show p-value in the {gt} table source notes rather than a column. |
... |
Not used |
Example 1
Example 2
Karissa Whiting
Other tbl_cross tools:
inline_text.tbl_cross()
,
tbl_cross()
# Example 1 ---------------------------------- add_p_cross_ex1 <- trial %>% tbl_cross(row = stage, col = trt) %>% add_p() # Example 2 ---------------------------------- add_p_cross_ex2 <- trial %>% tbl_cross(row = stage, col = trt) %>% add_p(source_note = TRUE)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.