calc_beta_div | R Documentation |
A wrapper around vegan::vegdist and rbiom (rbiom used for UniFrac calculations). For unifrac: "wunifrac" = weighted unifrac, "unifrac" = unweighted unifrac. The function returns a tidy dataframe of PCoA axes (PC1 & PC2), percent variance explained for each PC.
calc_beta_div( df, tree = NULL, method = c("wunifrac", "unifrac", "manhattan", "euclidean", "canberra", "clark", "bray", "kulczynski", "jaccard", "gower", "altGower", "morisita", "horn", "mountford", "raup", "binomial", "chao", "cao", "mahalanobis"), threads = 1 )
df |
sample x taxon dataframe. Colnames (taxa) must match the tree tip labels if the tree is provided |
tree |
phylogeny with tips matching the df colnames (only needed for wunifrac & unifrac methods) |
method |
distance method (vegdist distances; wunifrac=Weighted Unifrac; unifrac=Unweighted Unifrac) |
threads |
threads used for UniFrac calculations with rbiom |
Unifrac is calculated with the https://github.com/cmmr/rbiom package (requires bioconductor packages).
If the goal is PCoA, then see the "tidy_PCoA" function.
data.frame
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.