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 nb_mods or bb_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 nb_mods or bb_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(bpd_cla); data(bpd_clin)

set <- tidy_micro(otu_tabs = bpd_cla, tab_names = "Class", clinical = bpd_clin,
prev_cutoff = 5, ra_cutoff = 0.1, exclude_taxa = c("Unclassified", "Bacteria")) %>%
filter(day == 7) ## Only including the first week

## Rank sum test on every taxa's relative abundance
set %>% micro_rank_sum(table = "Class", grp_var = bpd1)

## Rank sum test on every taxa whose model didn't converge
nb_cla <- nb_mods(set, table = "Class", bpd1)

micro_rank_sum(micro_set = set, table = "Class",
grp_var = bpd1, mod = nb_cla)

tidyMicro documentation built on Jan. 13, 2021, 6:18 a.m.