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.
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
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")