View source: R/add_p.tbl_cross.R
add_p.tbl_cross | R Documentation |
Calculate and add a p-value comparing the two variables in the cross table. If missing levels are included in the tables, they are also included in p-value calculation.
## S3 method for class 'tbl_cross'
add_p(
x,
test = NULL,
pvalue_fun = ifelse(source_note, label_style_pvalue(digits = 1, prepend_p = TRUE),
label_style_pvalue(digits = 1)),
source_note = FALSE,
test.args = NULL,
...
)
x |
( |
test |
( |
pvalue_fun |
( |
source_note |
(scalar |
test.args |
(named |
... |
These dots are for future extensions and must be empty. |
Karissa Whiting, Daniel D. Sjoberg
# Example 1 ----------------------------------
trial |>
tbl_cross(row = stage, col = trt) |>
add_p()
# Example 2 ----------------------------------
trial |>
tbl_cross(row = stage, col = trt) |>
add_p(source_note = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.