These functions are wrappers around dplyr::mutate() and dplyr::transmute() that provide convenient ways to modify tax_table(x) and sample_data(x) as well as the sample and taxa names.

mutate_tax_table(x, ...)

# S4 method for taxonomyTable
mutate_tax_table(x, ...)

# S4 method for phyloseq
mutate_tax_table(x, ...)

transmute_tax_table(x, ...)

# S4 method for taxonomyTable
transmute_tax_table(x, ...)

# S4 method for phyloseq
transmute_tax_table(x, ...)

mutate_sample_data(x, ...)

# S4 method for sample_data
mutate_sample_data(x, ...)

# S4 method for phyloseq
mutate_sample_data(x, ...)

transmute_sample_data(x, ...)

# S4 method for sample_data
transmute_sample_data(x, ...)

# S4 method for phyloseq
transmute_sample_data(x, ...)

Arguments

x

A phyloseq, taxonomyTable, or sample_data object

...

Expressions passed to dplyr::mutate() or dplyr::transmute()

Details

When modifying the taxonomy table, the .otu column name can be used to set new taxa names. When modifying the sample data, the .sample column name can be used to set new taxa names.

The experimental arguments to dplyr::mutate() of .keep, .before, and .after are not currently supported and may result in errors or unexpected behavior.

Examples

data(GlobalPatterns) ps <- GlobalPatterns %>% transmute_sample_data(SampleType, sample_sum = sample_sums(.)) %>% filter_sample_data(SampleType %in% c("Feces", "Skin", "Tongue")) %>% filter_tax_table(Kingdom == "Bacteria") %>% tax_glom("Phylum") %>% transmute_tax_table(Kingdom, Phylum, .otu = Phylum)
#> Error in transmute_tax_table(., Kingdom, Phylum, .otu = Phylum): could not find function "transmute_tax_table"
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'sample_data': object 'ps' not found
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'tax_table': object 'ps' not found