add_lib_size: Add total abundance per sample

View source: R/adders_samples.R

add_lib_sizeR Documentation

Add total abundance per sample

Description

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

Usage

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()


SWittouck/tidyamplicons documentation built on Aug. 15, 2023, 3:14 a.m.