Learn R Programming

tidyMicro (version 1.47)

beta_div: Beta Diversity Calculations for tidy_micro

Description

Calculate beta diversities of your tidy_micro set. This function reformats the data into the original OTU table and then feeds that into the vegdist function

Usage

beta_div(micro_set, table, method = "bray")

Arguments

micro_set

A tidy_micro data set

table

Table you'd like to use when calculating alpha diversity. Your lowest level is recommended

method

A dissimilarity method compatible with vegdist

Value

A symmetrix distance matrix

References

vegdist

Examples

Run this code
# NOT RUN {
data(bpd_phy); data(bpd_cla); data(bpd_ord); data(bpd_fam); data(bpd_clin)

otu_tabs <- list(Phylum = bpd_phy, Class = bpd_cla,
Order = bpd_ord, Family = bpd_fam)
set <- tidy_micro(otu_tabs = otu_tabs, clinical = bpd_clin) %>%
filter(day == 7) ## Only including the first week

## Bray-Curtis beta diversity
bray <- set %>% beta_div(table = "Family")

## Morisita-Horn beta diversity
horn <- set %>% beta_div(table = "Family", method = "horn")
# }

Run the code above in your browser using DataLab