| beta_div | R Documentation |
Beta Diversity Wrapper Function
beta_div(
counts,
metric,
norm = "percent",
power = 1.5,
pseudocount = NULL,
alpha = 0.5,
tree = NULL,
pairs = NULL,
margin = 1L,
cpus = n_cpus()
)
counts |
A numeric matrix of count data where each column is a
feature, and each row is a sample. Any object coercible with
|
metric |
The name of a beta diversity metric. One of |
norm |
Normalize the incoming counts. Options are:
Default: |
power |
Scaling factor for the magnitude of differences between
communities ( |
pseudocount |
The value to add to all counts in |
alpha |
How much weight to give to relative abundances; a value
between 0 and 1, inclusive. Setting |
tree |
A |
pairs |
Which combinations of samples should distances be
calculated for? The default value ( |
margin |
If your samples are in the matrix's rows, set to |
cpus |
How many parallel processing threads should be used. The
default, |
List of Beta Diversity Metrics
| Option / Function Name | Metric Name |
aitchison | Aitchison distance |
bhattacharyya | Bhattacharyya distance |
bray | Bray-Curtis dissimilarity |
canberra | Canberra distance |
chebyshev | Chebyshev distance |
chord | Chord distance |
clark | Clark's divergence distance |
divergence | Divergence |
euclidean | Euclidean distance |
generalized_unifrac | Generalized UniFrac (GUniFrac) |
gower | Gower distance |
hamming | Hamming distance |
hellinger | Hellinger distance |
horn | Horn-Morisita dissimilarity |
jaccard | Jaccard distance |
jensen | Jensen-Shannon distance |
jsd | Jesen-Shannon divergence (JSD) |
lorentzian | Lorentzian distance |
manhattan | Manhattan distance |
matusita | Matusita distance |
minkowski | Minkowski distance |
morisita | Morisita dissimilarity |
motyka | Motyka dissimilarity |
normalized_unifrac | Normalized Weighted UniFrac |
ochiai | Otsuka-Ochiai dissimilarity |
psym_chisq | Probabilistic Symmetric Chi-Squared distance |
soergel | Soergel distance |
sorensen | Dice-Sorensen dissimilarity |
squared_chisq | Squared Chi-Squared distance |
squared_chord | Squared Chord distance |
squared_euclidean | Squared Euclidean distance |
topsoe | Topsoe distance |
unweighted_unifrac | Unweighted UniFrac |
variance_adjusted_unifrac | Variance-Adjusted Weighted UniFrac (VAW-UniFrac) |
wave_hedges | Wave Hedges distance |
weighted_unifrac | Weighted UniFrac |
Flexible name matching
Case insensitive and partial matching. Any runs of non-alpha characters are
converted to underscores. E.g. metric = 'Weighted UniFrac selects
weighted_unifrac.
UniFrac names can be shortened to the first letter plus "unifrac". E.g.
uunifrac, w_unifrac, or V UniFrac. These also support partial matching.
Finished code should always use the full primary option name to avoid ambiguity with future additions to the metrics list.
A numeric vector.
# Example counts matrix
ex_counts
# Bray-Curtis distances
beta_div(ex_counts, 'bray')
# Generalized UniFrac distances
beta_div(ex_counts, 'GUniFrac', tree = ex_tree)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.