nmds_phyloseq: Create a ggplot object of the NMDS from a phyloseq object....

View source: R/nmds_phyloseq.R

nmds_phyloseqR Documentation

Create a ggplot object of the NMDS from a phyloseq object. Function from the phylosmith-package.

Description

Inputs a phyloseq-class object and plots the NMDS of a treatment or set of treatments in space.

Usage

nmds_phyloseq(phyloseq_obj, treatment, method = 'bray', dimensions = 2, trymax = 100, 
circle = 0.95, labels = NULL, colors = 'default', verbose = TRUE)

Arguments

phyloseq_obj

A phyloseq-class object. It must contain sample_data()) with information about each sample, and it must contain tax_table()) with information about each taxa/gene.

treatment

Column name as a string or number in the sample_data. This can be a vector of multiple columns and they will be combined into a new column.

method

the distance measurement algorithm to use, match to "euclidean", "manhattan", "canberra", "clark", "bray", "kulczynski", "jaccard", "gower", "altGower", "morisita", "horn", "mountford", "raup", "binomial", "chao", "cao" or "mahalanobis".

dimensions

Number of dimensions. NB., the number of points n should be n > 2*k + 1, and preferably higher in global non-metric MDS, and still higher in local NMDS.

trymax

Maximum numbers of random starts in search of stable solution. The iteration will stop when two convergent solutions were found or trymax was reached.

circle

If TRUE, a stat_ellipse around each of the treatment factors (TRUE). If numeric between 0 and 1, will add ellipse of confidence interval equal to value given (i.e. 0.95 produces ellipses of 95% confidence intervals)

labels

Column name as a string or number in the sample_data to use to place labels of that factor instead of circle points.

colors

Name of a color set from the RColorBrewer package or a vector palette of R-accepted colors.

verbose

Whether or not to print the metaMDS stress convergence to console (TRUE) or not (FALSE).

Value

ggplot-object

Examples

nmds_phyloseq(soil_column, c('Matrix', 'Treatment'),
circle = TRUE, verbose = FALSE)

schuyler-smith/phylosmith documentation built on Aug. 17, 2024, 10:19 a.m.