ggtaxplot: ggtaxplot Process and Plot Taxonomic Data

View source: R/ggtaxplot.R

ggtaxplotR Documentation

ggtaxplot Process and Plot Taxonomic Data

Description

This function processes data and generates a taxonomic river plot.

Usage

ggtaxplot(
  data,
  ID_col = "ID",
  tax_col = "Taxonomy",
  rm_NA = FALSE,
  threshold = 2,
  custom_colors = NULL
)

Arguments

data

A data frame containing two columns: ID and Taxonomy.

ID_col

A column with ID values.

tax_col

A column with Taxonomy.

rm_NA

A logical value indicating whether to remove rows where the taxonomy column is 'Unknown' or NA. Default is FALSE.

threshold

A numeric threshold for filtering low-abundance taxa (Others).

custom_colors

Optional custom colors assigned to phyla.

Value

A ggplot object of the river plot.

Examples

# Example data frame
data <- data.frame(
 ID = c("ID1", "ID2", "ID3"),
 Taxonomy = c("d__Bacteria;p__Proteobacteria;c__Gammaproteobacteria;\
 o__Enterobacterales;f__Enterobacteriaceae;g__Escherichia",
            "d__Bacteria;p__Actinobacteria;c__Actinobacteria;\
            o__Corynebacteriales;f__Corynebacteriaceae;g__Corynebacterium",
            "d__Bacteria;p__Firmicutes;c__Bacilli;\
            o__Bacillales;f__Bacillaceae;g__Bacillus")
            )
# Generate the river plot
plot <- ggtaxplot(data)
print(plot)

ggtaxplot documentation built on April 4, 2025, 4:39 a.m.