micro_rank_sum: Run rank sum tests for each taxa within an OTU table

Description Usage Arguments Details Value References Examples

View source: R/micro_rank_sum.R

Description

Runs a rank sum test for each taxa within an OTU table or each taxa that didn't converge in mods

Usage

1
micro_rank_sum(micro_set, table, grp_var, y = ra, mod = NULL, ...)

Arguments

micro_set

A tidy_micro data set

table

OTU table of interest

grp_var

A factor variable for grouping

y

A continuous response variable. Taxa relative abundance (ra) is recommended

mod

The output from mods if desired

...

Options to be passed to wilcox.test or kruskal.test

Details

The grp_var must have a least 2 levels. For a 2 level factor a Mann-Whitney test will be calculated through wilcox.test, and for 3 or more levels a Kruskal-Wallis test will be run throuh kruskal.test

Value

A data frame containing the p-value for each taxa's rank sum test.

References

kruskal.test and wilcox.test

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
data(phy); data(cla); data(ord); data(fam); data(met)

otu_tabs = list(Phylum = phy, Class = cla, Order = ord, Family = fam)
set <- tidy_micro(otu_tabs = otu_tabs, meta = met) %>%
filter(day == 7) \
mutate(bpd1 = factor(bpd1))

## Rank sum test on every taxa's relative abundance
set \

## Rank sum test on every taxa whose model didn't converge
set \
nb_mods(table = "Family", bpd1) \
micro_rank_sum(table = "Family", grp_var = bpd1, mod = nb_fam)

CharlieCarpenter/tidy.micro documentation built on Jan. 19, 2020, 6:28 p.m.