ps_mutate | R Documentation |
Add or compute new phyloseq sample_data variables.
Uses dplyr::mutate()
syntax.
ps_mutate(ps, ...)
ps |
phyloseq object with sample data |
... |
passed straight to dplyr::mutate (see examples and dplyr::mutate help) |
phyloseq object with modified sample_data
tax_mutate
for manipulation of tax_table variables
mutate
library(phyloseq)
library(dplyr)
data("enterotype")
sample_data(enterotype)[1:10, ]
months_in_year <- 12
ps <- enterotype %>%
ps_mutate(
age_months = Age * months_in_year,
IDs_match = as.character(Sample_ID) == as.character(SampleID),
placeholder = "Word"
)
sample_data(ps)[1:10, ]
# Using the dplyr::across functionality is also possible
ps <- ps %>%
ps_mutate(
dplyr::across(where(is.factor), toupper),
another_var = TRUE,
SeqTech = NULL # deletes SeqTech variable
)
head(sample_data(ps))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.