pstoveg_otu: converts the otu_table slot of a phyloseq object to a...

Description Usage Arguments Value See Also Examples

View source: R/pstoveg_otu.R

Description

physeq2veg_otu is a helper function intended to convert the species/taxa count slot of a phyloseq object to a vegan-friendly matrix. This function ensures that sites/samples are rows and species are columns.

Usage

1

Arguments

PS

(required) a phyloseq object

Value

A matrix containing a phyloseq object's otu_table slot.

See Also

phyloseq-class otu_table-class otu_table

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Not run: 
library(theseus)
library(phyloseq)
data(WWTP_Impact, package='theseus')
dim(otu_table(WWTP_Impact))
taxa_are_rows(WWTP_Impact)
otu <- pstoveg_otu(WWTP_Impact)
dim(otu)

data(GlobalPatterns, package='phyloseq')
dim(otu_table(GlobalPatterns))
taxa_are_rows(GlobalPatterns)
otu.gp <-pstoveg_otu(GlobalPatterns)
dim(otu.gp)

# move transformed OTU table back to phyloseq
wwtp <- WWTP_Impact
otu.ra <- vegan::decostand(otu, method='total')
otu_table(wwtp) <- otu_table(otu.ra,
                             taxa_are_rows = taxa_are_rows(WWTP_Impact))

## End(Not run)

theseus documentation built on May 2, 2019, 9:39 a.m.