compare_n_numvars | R Documentation |
Some names were changed in August 2022, to reflect the update of the function to handle ordinal data using non-parametric equivalents.
compare_n_numvars(
.data = rawdata,
dep_vars,
indep_var,
gaussian,
round_desc = 2,
range = FALSE,
rangesep = " ",
pretext = FALSE,
mark = FALSE,
round_p = 3,
add_n = FALSE
)
.data |
name of dataset (tibble/data.frame) to analyze, defaults to rawdata. |
dep_vars |
vector of column names. |
indep_var |
name of grouping variable. |
gaussian |
Logical specifying normal or ordinal indep_var (and chooses comparison tests accordingly) |
round_desc |
number of significant digits for rounding of descriptive stats. |
range |
include min/max? |
rangesep |
text between statistics and range or other elements. |
pretext , mark |
for function formatP. |
round_p |
level for rounding p-value. |
add_n |
add n to descriptive statistics? |
A list with elements "results": tibble with descriptive statistics, p-value from ANOVA/Kruskal-Wallis test, p-values for pairwise comparisons, significance indicators, and descriptives pasted with significance. "raw": nested list with output from all underlying analyses.
# Usually,only the result table is relevant:
compare_n_numvars(
.data = mtcars, dep_vars = c("wt", "mpg", "hp"),
indep_var = "cyl",
gaussian = TRUE
)$results
# For a report, result columns may be filtered as needed:
compare_n_numvars(
.data = mtcars, dep_vars = c("wt", "mpg", "hp"),
indep_var = "cyl",
gaussian = FALSE
)$results |>
dplyr::select(Variable, `cyl 4 fn`:`cyl 8 fn`, multivar_p)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.