add_p {tidysummary} | R Documentation |
Add statistical test results to summary data
Description
Calculates and appends p-values with optional statistical details to a summary table based on variable types and group comparisons. Handles both continuous and categorical variables with appropriate statistical tests.
Usage
add_p(
summary,
digit = 3,
asterisk = FALSE,
add_method = FALSE,
add_statistic_name = FALSE,
add_statistic_value = FALSE
)
Arguments
summary |
A data frame that has been processed by |
digit |
A numeric determine decimal. Accepts:
|
asterisk |
Logical indicating whether to show asterisk significance markers. |
add_method |
Control parameter for display of statistical methods. Accepts:
|
add_statistic_name |
Logical indicating whether to include test statistic names. |
add_statistic_value |
Logical indicating whether to include test statistic values. |
Value
A data frame merged with statistical test results, containing: - Variable names - Summary - Formatted p-values - Optional method names/codes - Optional statistic names/values
Examples
# `summary` is a data frame processed by `add_var()` and `add_summary()`:
data <- add_var(iris, var = c("Sepal.Length", "Species"), group = "Species")
summary <- add_summary(data)
# Add statistical test results
result <- add_p(summary)