View source: R/cyt_univiariate.R
| cyt_univariate | R Documentation |
cyt_univariate supports additional scaling options and explicit
choice of statistical test.
For each categorical predictor with exactly two levels and each
numeric outcome, a two‑sample t‑test or Wilcoxon rank–sum test is
performed. Results are returned either as a list of test objects
or, if format_output = TRUE, as a tidy data frame with one
row per comparison.
cyt_univariate(
data,
scale = NULL,
method = c("auto", "ttest", "wilcox"),
verbose = TRUE,
format_output = FALSE,
custom_fn = NULL,
p_adjust_method = NULL
)
data |
A data frame or matrix containing both categorical and numeric variables. |
scale |
A character specifying a transformation to apply to
numeric variables prior to testing. Choices are |
method |
Character specifying the test to perform. Use "auto" (default) to select between t‑test and Wilcoxon based on Shapiro–Wilk normality tests for each outcome; "ttest" to always use Student’s t‑test; or "wilcox" to always use the Wilcoxon rank–sum test. |
verbose |
Logical indicating whether to return the results. Provided for backward compatibility but has no effect on printing. |
format_output |
Logical. If |
custom_fn |
A function to apply when |
p_adjust_method |
Character or |
If format_output = FALSE, a named list of test objects
keyed by "Outcome_Categorical". If format_output = TRUE, a
data frame with columns Outcome, Categorical, Comparison,
Test, Estimate, Statistic, and P_value.
Shubh Saraswat
data_df <- ExampleData1[, -c(3)]
data_df <- dplyr::filter(data_df, Group != "ND", Treatment != "Unstimulated")
cyt_univariate(data_df[, c(1:2, 5:6)], scale = "log2",
method = "auto", format_output = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.