bdiv_table | R Documentation |
Distance / dissimilarity between samples.
bdiv_table(
biom,
bdiv = "Bray-Curtis",
weighted = TRUE,
normalized = TRUE,
tree = NULL,
md = ".all",
within = NULL,
between = NULL,
delta = ".all",
transform = "none",
ties = "random",
seed = 0,
cpus = NULL
)
bdiv_matrix(
biom,
bdiv = "Bray-Curtis",
weighted = TRUE,
normalized = TRUE,
tree = NULL,
within = NULL,
between = NULL,
transform = "none",
ties = "random",
seed = 0,
cpus = NULL,
underscores = FALSE
)
bdiv_distmat(
biom,
bdiv = "Bray-Curtis",
weighted = TRUE,
normalized = TRUE,
tree = NULL,
within = NULL,
between = NULL,
transform = "none",
cpus = NULL
)
biom |
An rbiom object, such as from |
bdiv |
Beta diversity distance algorithm(s) to use. Options are:
|
weighted |
Take relative abundances into account. When
|
normalized |
Only changes the "Weighted UniFrac" calculation.
Divides result by the total branch weights. Default: |
tree |
A |
md |
Dataset field(s) to include in the output data frame, or |
within , between |
Dataset field(s) for intra- or inter- sample
comparisons. Alternatively, dataset field names given elsewhere can
be prefixed with |
delta |
For numeric metadata, report the absolute difference in values
for the two samples, for instance |
transform |
Transformation to apply. Options are:
|
ties |
When |
seed |
Random seed for permutations. Must be a non-negative integer.
Default: |
cpus |
The number of CPUs to use. Set to |
underscores |
When parsing the tree, should underscores be kept as
is? By default they will be converted to spaces (unless the entire ID
is quoted). Default |
bdiv_matrix()
- An R matrix of samples x samples.
bdiv_distmat()
- A dist-class distance matrix.
bdiv_table()
- A tibble data.frame with columns names .sample1, .sample2, .weighted,
.bdiv, .distance, and any fields requested by md
. Numeric metadata
fields will be returned as abs(x - y)
; categorical metadata fields as
"x"
, "y"
, or "x vs y"
.
Prefix metadata fields with ==
or !=
to limit comparisons to within or
between groups, respectively. For example, stat.by = '==Sex'
will
run calculations only for intra-group comparisons, returning "Male" and
"Female", but NOT "Female vs Male". Similarly, setting
stat.by = '!=Body Site'
will only show the inter-group comparisons, such
as "Saliva vs Stool", "Anterior nares vs Buccal mucosa", and so on.
The same effect can be achieved by using the within
and between
parameters. stat.by = '==Sex'
is equivalent to
stat.by = 'Sex', within = 'Sex'
.
Other beta_diversity:
bdiv_boxplot()
,
bdiv_clusters()
,
bdiv_corrplot()
,
bdiv_heatmap()
,
bdiv_ord_plot()
,
bdiv_ord_table()
,
bdiv_stats()
,
distmat_stats()
library(rbiom)
# Subset to four samples
biom <- hmp50$clone()
biom$counts <- biom$counts[,c("HMP18", "HMP19", "HMP20", "HMP21")]
# Return in long format with metadata
bdiv_table(biom, 'unifrac', md = ".all")
# Only look at distances among the stool samples
bdiv_table(biom, 'unifrac', md = c("==Body Site", "Sex"))
# Or between males and females
bdiv_table(biom, 'unifrac', md = c("Body Site", "!=Sex"))
# All-vs-all matrix
bdiv_matrix(biom, 'unifrac')
# All-vs-all distance matrix
dm <- bdiv_distmat(biom, 'unifrac')
dm
plot(hclust(dm))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.