make_ord_df: Make a data frame of the ordination

View source: R/prep_plt_ord.R

make_ord_dfR Documentation

Make a data frame of the ordination

Description

Take a phyloseq object and generate a data frame of the distance-based ordination of the samples for plotting. This function has been tested with ordination methods 'PCoA' and 'RDA'. I can't make any promises if you use a different ordination method.

Usage

make_ord_df(
  physeq,
  dist_meth = "bray",
  ord_meth = "PCoA",
  scree_only = FALSE,
  axes = 1:4
)

Arguments

physeq

A phyloseq object with an OTU table and sample data. The table should be normalized (rarefied, relative abundance, some kind of log-ratio transformation) so that the distance metrics will be meaningful. Make sure that the transformation you have used is appropriate for the distance method you choose.

dist_meth

The distance method to be use. Must be one of the methods accepted by the phyloseq::distance() function. Default is 'bray'. If 'jaccard' is used, adds the binary = TRUE argument. If you have taken a clr transform of your data and want Aitchison distances, choose 'euclidean'. Currently, tree-based methods like 'unifrac' and 'wunifrac' are not supported.

ord_meth

The ordination method. Must be one of the methods accepted by the phyloseq::ordinate() function. Default is 'PCoA'. Make sure the ordination method you choose is appropriate for your distance method.

scree_only

If TRUE, this function will print the scree plot of the requested ordination and then exit. Good for deciding how many axes you care about. Default is FALSE.

axes

A vector of integers indicating which ordination axes to include in the data frame. Defaults to 1:4.


JCSzamosi/aftersl1p documentation built on July 3, 2025, 8:37 p.m.