add_rel_abundance.Rd
add_rel_abundance
adds relative abundance to the abundance table of a
tidyamplicons object.
add_rel_abundance(ta)
Tidyamplicons object.
This function adds the relative abundance per sample to the abundance table of a tidyamplicons object under the variable name "rel_abundance".
# 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()