tax_mutate | R Documentation |
Add or overwrite tax_table ranks. Use dplyr::mutate() syntax.
tax_mutate(ps, ...)
ps |
phyloseq object with a tax_table, or just a tax_table |
... |
passed straight to dplyr::mutate (see examples and dplyr::mutate help) |
phyloseq object with modified tax_table
mutate
ps_mutate
library(phyloseq)
library(dplyr)
data("dietswap", package = "microbiome")
# compute new rank
tax_mutate(dietswap, loud_genus = toupper(Genus)) %>%
tt_get() %>%
head()
# overwrite a current rank
tax_mutate(dietswap, Genus = toupper(Genus)) %>%
tt_get() %>%
head()
# overwrite all ranks
tax_mutate(dietswap, across(everything(), .fns = toupper)) %>%
tt_get() %>%
head()
# add a new rank at the beginning
tax_mutate(dietswap, Root = "Bacteria", .before = 1) %>%
tt_get() %>%
head()
# this is an error as ranks can't be any other class than character
# tax_mutate(dietswap, Genus = 1:ntaxa(dietswap))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.