add_rel_abundance: Add relative abundance to abundance table

View source: R/adders_abundances.R

add_rel_abundanceR Documentation

Add relative abundance to abundance table

Description

add_rel_abundance adds relative abundance to the abundance table of a tidyamplicons object.

Usage

add_rel_abundance(ta)

Arguments

ta

Tidyamplicons object.

Details

This function adds the relative abundance per sample to the abundance table of a tidyamplicons object under the variable name "rel_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 relative abundance
data <- data %>%
 add_rel_abundance()


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