cyt_univariate_multiprovides univariate statistical testing for
categorical predictors with more than two levels. For each
categorical predictor and numeric outcome pair, a global test is
performed, followed by pairwise comparisons if the global test is
significant. Users may choose between two methods,
classical ANOVA with Tukey’s Honest Significant Difference (HSD)
or a non‑parametric Kruskal–Wallis test followed by pairwise
Wilcoxon rank–sum tests. The return format can either be a list
of adjusted p‑values for each outcome–predictor pair or, if
format_output = TRUE, a tidy data frame summarizing all
pairwise comparisons.
cyt_univariate_multi(
data,
method = c("anova", "kruskal"),
cat_vars = NULL,
cont_vars = NULL,
p_adjust_method = "BH",
format_output = FALSE
)Either a list (if format_output = FALSE) or a data
frame (if format_output = TRUE).
A data frame or matrix containing both categorical and continuous variables. Character columns will be converted to factors.
Character specifying the type of global test to perform. Use "anova" (default) for one‑way ANOVA with Tukey HSD or "kruskal" for Kruskal–Wallis with pairwise Wilcoxon tests.
Optional character vector of predictor column
names. When NULL, all factor or character columns in data
are used.
Optional character vector of numeric outcome
variable names. When NULL, all numeric columns in data are
used.
Character string specifying the method for
p‑value adjustment across pairwise comparisons. Passed to
p.adjust. Default is "BH".
Logical. If TRUE, returns a tidy data
frame; otherwise (default) returns a list of numeric vectors
keyed by "Outcome_Categorical". Each numeric vector contains
adjusted p‑values for the pairwise comparisons.
Shubh Saraswat
data("ExampleData1")
cyt_univariate_multi(ExampleData1[, c(1:2, 5:6)], method = "kruskal",
format_output = TRUE)
Run the code above in your browser using DataLab