ps_ordinate: Community phylogenetic ordination

View source: R/ps_ordinate.R

ps_ordinateR Documentation

Community phylogenetic ordination

Description

Perform an ordination that reduces a spatial phylogenetic data set into k dimensions, using one of several alternative ordination algorithms.

Usage

ps_ordinate(ps, method = c("cmds", "nmds", "pca"), k = 3, spatial = TRUE)

Arguments

ps

A phylospatial object. Unless method = "pca", ps must have a non-null dissim component, generated by ps_add_dissim.

method

Ordination method, either "cmds" (the default, classical MDS, implemented via stats::cmdscale(), "nmds" (nonmetric MDS, implemented via vegan::metaMDS(); this is slower but often preferred), or "pca" (principal component analysis, implemented via stats::prcomp()),.

k

Positive integer giving the desired number of output dimensions; default is 3.

spatial

Logical indicating whether a spatial object (inherited from ps) should be returned. Default is TRUE.

Value

A matrix or spatial object with k variables.

See Also

For visualization using ordination onto RGB color space, see ps_rgb().

Examples

ps <- ps_add_dissim(ps_simulate(50, 5, 5))
ord <- ps_ordinate(ps, method = "cmds", k = 4)
terra::plot(ord)


phylospatial documentation built on Dec. 24, 2025, 1:06 a.m.