phy_beta_div_betw_withn: Beta diversity into group boxplots

phy_beta_div_betw_withnR Documentation

Beta diversity into group boxplots

Description

Function taking a phyloseq object or a diversity matrix and spits out group-wise interindividual diversity

Usage

phy_beta_div_betw_withn(
  physeq,
  dist,
  variab,
  verbose = FALSE,
  btwn_pairwise = FALSE
)

Arguments

physeq

a phyloseq object, important for the metadata it contains

dist

either specify a metric (see ?phyloseq::distance for more info), or pass a distance matrix either in the matrix or dist format

variab

variable to segregate beta diversity values by. must be a character with a name in the physeq's metadata

verbose

should it print out the steps it is performing? (default is FALSE)

btwn_pairwise

should a third element be calculated and appended to the results? these will be pairwise comparisons of samples in each variable level.

Value

a data.frame object containing within and between diversities based on the variable specified. "between_pairwise" are calculated as "for each level of the variable categories, find diversities of all samples belonging to it against all other samples not belonging to it".

Examples


library(phyloseq)
data(GlobalPatterns)

betadiversitiesFull <- phy_beta_div_betw_withn(physeq = GlobalPatterns, dist = "bray", variab = "Site", verbose = TRUE, btwn_pairwise = TRUE)

betadiversitiesSimpler <- phy_beta_div_betw_withn(physeq = GlobalPatterns, dist = "bray", variab = "Site", verbose = TRUE, btwn_pairwise = FALSE)

g-antonello/gautils2 documentation built on Nov. 28, 2022, 9:39 a.m.