add_lib_size adds the total abundance per sample to the samples tibble of a tidyamplicons object.

add_lib_size(ta, step = "current")

Arguments

ta

Tidyamplicons object.

Details

This function adds the total abundance per sample to the samples tibble of a tidyamplicons object under the variable name total_abundance.

Examples

# Initiate abundance matrix
x <- matrix(
 c(1500, 1300, 280, 356),
 ncol = 2
)
rownames(x) <- c("taxon1", "taxon2")
colnames(x) <- c("sample1", "sample2")

# Convert to tidyamplicons object
data <- create_tidyamplicons(x,
                     taxa_are_columns = FALSE
                     )

# Add total abundance
data <- data %>%
 add_lib_size()