add_alpha()
adds an alpha diversity measures to the sample table of a
tidytacos object.
Arguments
- ta
A tidytacos object.
- method
The diversity measure to use, see
vegan::diversity()
for further information on these.- keep_empty_samples
Whether to keep empty samples or not.
Details
This function can add different alpha diversity measures to the sample table, specified by the method argument. The following methods are available:
invsimpson: Inverse Simpson index
shannon: Shannon index
simpson: Simpson index
pielou: Pielou's evenness index
obs: Observed richness
s.chao1: Chao1 richness estimator
s.ace: ACE richness estimator
See also
Other sample-modifiers:
add_alphas()
,
add_metadata()
,
add_ord()
,
add_sample_clustered()
,
add_spike_ratio()
,
add_total_absolute_abundance()
,
add_total_count()
,
add_total_density()
,
cluster_samples()
Other diversity-metrics:
add_alphas()
,
add_ord()
Examples
# Initiate counts matrix
x <- matrix(
c(1500, 1300, 280, 356),
ncol = 2
)
rownames(x) <- c("taxon1", "taxon2")
colnames(x) <- c("sample1", "sample2")
# Convert to tidytacos object
data <- create_tidytacos(x,
taxa_are_columns = FALSE
)
# Add alpha diversity measures
data <- data %>%
add_alpha()
data <- data %>%
add_alpha(method = "shannon")