compare_n_numvars: Comparison for columns of Gaussian or ordinal measures for n...

compare_n_numvarsR Documentation

Comparison for columns of Gaussian or ordinal measures for n groups

Description

Some names were changed in August 2022, to reflect the update of the function to handle ordinal data using non-parametric equivalents.

Usage

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
)

Arguments

.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?

Value

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.

Examples

# 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)

wrappedtools documentation built on Oct. 10, 2024, 5:07 p.m.