compare_n_qualvars: Comparison for columns of factors for more than 2 groups with...

compare_n_qualvarsR Documentation

Comparison for columns of factors for more than 2 groups with post-hoc

Description

Comparison for columns of factors for more than 2 groups with post-hoc

Usage

compare_n_qualvars(
  data,
  dep_vars,
  indep_var,
  round_p = 3,
  round_desc = 2,
  pretext = FALSE,
  mark = FALSE,
  singleline = FALSE,
  spacer = " ",
  linebreak = "\n",
  prettynum = FALSE
)

Arguments

data

name of data set (tibble/data.frame) to analyze.

dep_vars

vector of column names.

indep_var

name of grouping variable.

round_p

level for rounding p-value.

round_desc

number of significant digits for rounding of descriptive stats

pretext

for function formatP

mark

for function formatP

singleline

Put all group levels in a single line?

spacer

Text element to indent levels, defaults to " ".

linebreak

place holder for newline.

prettynum

Apply prettyNum to results?

Value

A tibble with variable names, descriptive statistics, and p-value of fisher.test and pairwise_fisher_test, number of rows is number of dep_vars.

Examples

# Separate lines for each factor level:
compare_n_qualvars(
  data = mtcars, dep_vars = c("am", "cyl", "carb"), indep_var = "gear",
  spacer = " "
)
# All levels in one row but with linebreaks:
compare_n_qualvars(
  data = mtcars, dep_vars = c("am", "cyl", "carb"), indep_var = "gear",
  singleline = TRUE
)
# All levels in one row, separateted by ";":
compare_n_qualvars(
  data = mtcars, dep_vars = c("am", "cyl", "carb"), indep_var = "gear",
  singleline = TRUE, linebreak = "; "
)

wrappedtools documentation built on Sept. 24, 2023, 5:06 p.m.