tax_scale | R Documentation |
Wrapper for applying base scale function to phyloseq otu_table
tax_scale(data, center = TRUE, scale = TRUE, do = NA, keep_counts = TRUE)
data |
phyloseq or psExtra or otu_table |
center |
if TRUE: center each taxon by subtracting its mean |
scale |
if TRUE, divide each centred taxon by its standard deviation (or divide by RMS if not centred!) |
do |
alternative argument that overrides center and scale options! takes "both", "scale", "center" or "neither" |
keep_counts |
if TRUE, retain the original count data in psExtra counts slot |
data("dietswap", package = "microbiome")
ps <- dietswap
ps %>%
otu_get() %>%
.[1:6, 1:6]
# standard use (mean center and SD scale)
tax_scale(ps) %>%
otu_get() %>%
.[1:6, 1:6] # Aerococcus is NaN as standard deviation = 0 (0 prevalence)
# RMS scale only (directly on otu_table)
otu_get(ps) %>%
tax_scale(center = FALSE) %>%
.[1:6, 1:6] # Aerococcus is NaN as standard deviation = 0 (0 prevalence)
# example using alternative `do` argument (to center only, no scaling)
tax_scale(ps, do = "center") %>%
otu_get() %>%
.[1:6, 1:6]
# preserves existing info
tax_transform(ps, "compositional", rank = "Genus") %>% tax_scale()
# drops other psExtra objects previously calculated with unscaled data
psxDist <- tax_agg(ps, "Genus") %>% dist_calc()
psxDist
psxDist %>% tax_scale()
tax_scale(psxDist) %>% info_get()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.