multi_compare: a container for performing two or more sample test.

View source: R/diff-analysis-utilities.R

multi_compareR Documentation

a container for performing two or more sample test.

Description

a container for performing two or more sample test.

Usage

multi_compare(
  fun = wilcox.test,
  data,
  feature,
  factorNames,
  subgroup = NULL,
  ...
)

Arguments

fun

character, the method for test, optional ""

data

data.frame, nrow sample * ncol feature+factorNames.

feature

vector, the features wanted to test.

factorNames

character, the name of a factor giving the corresponding groups.

subgroup

vector, the names of groups, default is NULL.

...

additional arguments for fun.

Value

the result of fun, if fun is wilcox.test, it will return the list with class "htest".

Author(s)

Shuangbin Xu

Examples

datest <- data.frame(A=rnorm(1:10,mean=5),
                     B=rnorm(2:11, mean=6), 
                     group=c(rep("case",5),rep("control",5)))
head(datest)
multi_compare(fun=wilcox.test,data=datest,
              feature=c("A", "B"),factorNames="group")
da2 <- data.frame(A=rnorm(1:15,mean=5),
                  B=rnorm(2:16,mean=6),
                  group=c(rep("case1",5),rep("case2",5),rep("control",5)))
multi_compare(fun=wilcox.test,data=da2,
              feature=c("A", "B"),factorNames="group",
              subgroup=c("case1", "case2"))

YuLab-SMU/MicrobiotaProcess documentation built on Nov. 8, 2024, 4:37 p.m.