Learn R Programming

theseus (version 0.1.0)

pstoveg_sd: converts the sam_data slot of a phyloseq object to a vegan-compatible matrix

Description

physeq2veg_sd is a helper function intended to convert the sample data slot of a phyloseq object to a vegan-friendly matrix.

Usage

pstoveg_sd(PS)

Arguments

PS

(required) a phyloseq object

Value

A matrix containing a phyloseq object's sam_data slot.

See Also

phyloseq-class sample_data-class sample_data

Examples

Run this code
# NOT RUN {
library(theseus)
library(phyloseq)
data(WWTP_Impact, package='theseus')
dim(sample_data(WWTP_Impact))
sampdat <- pstoveg_sd(WWTP_Impact)
dim(sampdat)

data(GlobalPatterns, package='phyloseq')
dim(sample_data(GlobalPatterns))
sampdat.gp <-pstoveg_sd(GlobalPatterns)
dim(sampdat.gp)

# move altered sample data back to phyloseq
sampdat.altered <- sampdat
sampdat.altered$TotDisP_PercentMax <- vegan::decostand(sampdat$TotDisP,
                                                       method='max')
sample_data(wwtp) <- as.data.frame(sampdat.altered)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab