Skip to contents

add_total_absolute_abundance() calculates the total absolute abundances of the samples given a spike taxon, and adds this to the sample table under the column name "total_absolute_abundance".

Usage

add_total_absolute_abundance(ta, spike_taxon, spike_added = spike_added)

Arguments

ta

A tidytacos object.

spike_taxon

The taxon id of the spike.

spike_added

The column name of the samples table which indicates how much spike was added per sample, e.g. 16S rRNA gene copy numbers added to the DNA extraction tube.

Value

A tidytacos object with the total absolute abundances added to the sample table.

Examples

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

# Convert to tidytacos object
data <- create_tidytacos(x,
  taxa_are_columns = FALSE
)
data$samples$spike_added <- c(100, 150)

# Add total abundance
data <- data %>%
  add_total_absolute_abundance(spike_taxon = "t3")