Define sample PAM clusters from beta diversity.
Arguments
- biom
An rbiom object, such as from
as_rbiom()
. Any value accepted byas_rbiom()
can also be given here.- bdiv
Beta diversity distance algorithm(s) to use. Options are:
"Bray-Curtis"
,"Manhattan"
,"Euclidean"
,"Jaccard"
, and"UniFrac"
. For"UniFrac"
, a phylogenetic tree must be present inbiom
or explicitly provided viatree=
. Default:"Bray-Curtis"
Multiple/abbreviated values allowed.- weighted
Take relative abundances into account. When
weighted=FALSE
, only presence/absence is considered. Default:TRUE
Multiple values allowed.- tree
A
phylo
object representing the phylogenetic relationships of the taxa inbiom
. Only required when computing UniFrac distances. Default:biom$tree
- k
Number of clusters. Default:
5L
- ...
Passed on to
cluster::pam()
.
See also
Other beta_diversity:
bdiv_boxplot()
,
bdiv_corrplot()
,
bdiv_heatmap()
,
bdiv_ord_plot()
,
bdiv_ord_table()
,
bdiv_stats()
,
bdiv_table()
,
distmat_stats()
Other clustering:
taxa_clusters()
Examples
library(rbiom)
biom <- rarefy(hmp50)
biom$metadata$bray_cluster <- bdiv_clusters(biom)
pull(biom, 'bray_cluster')[1:10]
#> HMP01 HMP02 HMP03 HMP04 HMP05 HMP06 HMP07 HMP08 HMP09 HMP10
#> 1 2 2 2 1 2 1 2 2 3
#> Levels: 1 2 3 4 5
bdiv_ord_plot(biom, stat.by = "bray_cluster")