Programmatic access to the lists of available metrics, and their associated functions.
Usage
metrics
as_alpha_metric(metric, multiple = FALSE, evar = "metric")
as_beta_metric(metric, multiple = FALSE, evar = "metric")
Value
metrics
is a nested list of functions for alpha and beta
diversity. as_alpha_metric()
and as_beta_metric()
return a validated
metric name or throws an error.
Examples
names(metrics)
#> [1] "alpha" "beta"
names(metrics$alpha)
#> [1] "observed" "chao1" "shannon" "simpson" "inv_simpson"
#> [6] "faith"
names(formals(metrics$alpha$faith))
#> [1] "counts" "tree" "cpus"
metrics$alpha$faith(ex_counts, ex_tree)
#> Saliva Gums Nose Stool
#> 180 191 215 202
as_alpha_metric('otus')
#> [1] "observed"
as_beta_metric('guni')
#> [1] "generalized_unifrac"