transform {microbiome} | R Documentation

## Data Transformations for phyloseq Objects

### Description

Standard transforms for `phyloseq-class`.

### Usage

    transform(x, transform = "identity", target = "OTU", shift = 0,
      scale = 1)

### Arguments

`x` | `phyloseq-class` object
`transform` | Transformation to apply. The options include: 'compositional' (ie relative abundance), 'Z', 'log10', 'log10p', 'hellinger', 'identity', 'clr', or any method from the vegan::decostand function.
`target` | Apply the transform for 'sample' or 'OTU'. Does not affect the log transform.
`shift` | A constant indicating how much to shift the baseline abundance (in transform='shift')
`scale` | Scaling constant for the abundance values when transform = "scale".

### Details

The relative abunance are returned as percentages in [0, 1]. The Hellinger transform is square root of the relative abundance but instead given at the scale [0,1]. The log10p transformation refers to log10(1 + x). The log10 transformation is applied as log10(1 + x) if the data contains zeroes.

### Value

Transformed `phyloseq` object

### Examples

    data(dietswap)
    x <- dietswap

    # No transformation
    xt <- transform(x, 'identity')

    # OTU relative abundances
    # xt <- transform(x, 'compositional')

    # Z-transform for OTUs
    # xt <- transform(x, 'Z', 'OTU')

    # Z-transform for samples
    # xt <- transform(x, 'Z', 'sample')

    # Log10 transform (log10(1+x) if the data contains zeroes)
    # xt <- transform(x, 'log10')

    # Log10p transform (log10(1+x) always)
    # xt <- transform(x, 'log10p')

    # CLR transform
    # xt <- transform(x, 'clr')

    # Shift the baseline
    # xt <- transform(x, 'shift', shift=1)

    # Scale
    # xt <- transform(x, 'scale', scale=1)

[Package microbiome version 1.2.1 Index]