rename_tax_table() and rename_with_tax_table() provide the functionality of dplyr::rename() and dplyr::rename_with() to phyloseq taxonomy tables; rename_sample_data() and rename_with_sample_data() provide this functionality to phyloseq sample data.

rename_tax_table(x, ...)

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

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

rename_with_tax_table(x, ...)

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

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

rename_sample_data(x, ...)

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

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

rename_with_sample_data(x, ...)

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

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

Arguments

x

A phyloseq, taxonomyTable, or sample_data object

...

Renaming expressions passed to dplyr::rename() or arguments passed to dplyr::rename_with()

Examples

data(GlobalPatterns) GlobalPatterns %>% rank_names
#> [1] "Kingdom" "Phylum" "Class" "Order" "Family" "Genus" "Species"
ps1 <- GlobalPatterns %>% rename_tax_table(Domain = Kingdom) %>% rename_with_tax_table(stringr::str_to_lower)
#> Error in rename_with_tax_table(., stringr::str_to_lower): could not find function "rename_with_tax_table"
ps1 %>% rank_names
#> 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 'tax_table': object 'ps1' not found
GlobalPatterns %>% sample_variables
#> [1] "X.SampleID" "Primer" #> [3] "Final_Barcode" "Barcode_truncated_plus_T" #> [5] "Barcode_full_length" "SampleType" #> [7] "Description"
ps2 <- GlobalPatterns %>% rename_with_sample_data(janitor::make_clean_names) %>% rename_sample_data(sample_id = x_sample_id)
#> Error in rename_sample_data(., sample_id = x_sample_id): could not find function "rename_sample_data"
ps2 %>% 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 'ps2' not found