View source: R/get_group_comparison.R
get_group_comparison | R Documentation |
Compare genotypes/phenotypes based on signature groups (samples are assigned to
several groups). For categorical
type, calculate fisher p value (using stats::fisher.test) and count table.
In larger than 2 by 2 tables, compute p-values by Monte Carlo simulation.
For continuous type, calculate anova p value (using stats::aov),
summary table and Tukey Honest significant difference (using stats::TukeyHSD).
The result of this function can be plotted by show_group_comparison()
.
get_group_comparison(
data,
col_group,
cols_to_compare,
type = "ca",
NAs = NA,
verbose = FALSE
)
data |
a |
col_group |
column name of signature groups. |
cols_to_compare |
column names of genotypes/phenotypes want to summarize based on groups. |
type |
a characater vector with length same as |
NAs |
default is |
verbose |
if |
a list
contains data, summary, p value etc..
Shixiang Wang w_shixiang@163.com
load(system.file("extdata", "toy_copynumber_signature_by_W.RData",
package = "sigminer", mustWork = TRUE
))
# Assign samples to clusters
groups <- get_groups(sig, method = "k-means")
set.seed(1234)
groups$prob <- rnorm(10)
groups$new_group <- sample(c("1", "2", "3", "4", NA), size = nrow(groups), replace = TRUE)
# Compare groups (filter NAs for categorical coloumns)
groups.cmp <- get_group_comparison(groups[, -1],
col_group = "group",
cols_to_compare = c("prob", "new_group"),
type = c("co", "ca"), verbose = TRUE
)
# Compare groups (Set NAs of categorical columns to 'Rest')
groups.cmp2 <- get_group_comparison(groups[, -1],
col_group = "group",
cols_to_compare = c("prob", "new_group"),
type = c("co", "ca"), NAs = "Rest", verbose = TRUE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.