These functions are wrappers around dplyr::relocate() that provide convenient ways to modify tax_table(x) and sample_data(x).

relocate_tax_table(x, ...)

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

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

relocate_sample_data(x, ...)

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

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

Arguments

x

A phyloseq, taxonomyTable, or sample_data object

...

Expressions and arguments passed to dplyr::relocate()

Details

The special column names '.otu' and '.sample' should not be used; see mutate-phyloseq for the ability to change taxa and sample names using these names.

Examples

data(GlobalPatterns) GlobalPatterns %>% sample_variables
#> [1] "X.SampleID" "Primer" #> [3] "Final_Barcode" "Barcode_truncated_plus_T" #> [5] "Barcode_full_length" "SampleType" #> [7] "Description"
ps <- GlobalPatterns %>% relocate_sample_data(SampleType, .after = X.SampleID)
#> Error in relocate_sample_data(., SampleType, .after = X.SampleID): could not find function "relocate_sample_data"
ps %>% sample_variables
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'colnames': error in evaluating the argument 'object' in selecting a method for function 'sample_data': object 'ps' not found