negation: Negation of ordination axes

negationR Documentation

Negation of ordination axes

Description

Negate the coordinates of a subset of ordination axes in both row and column singular vectors.

Usage

get_negation(x)

revert_negation(x)

negate_ord(x, negation = NULL)

negate_to_first_orthant(x, .matrix)

Arguments

x

A tbl_ord.

negation

Integer vector of coordinates to negate.

.matrix

A character string partially matched (lowercase) to several indicators for one or both matrices in a matrix decomposition used for ordination. The standard values are "rows", "cols", and "dims" (for both).

Details

For purposes of comparison and visualization, it can be useful to negate the (already artificial) coordinates of an ordination, either by fixed criteria or to better align with another basis (matrix) of coordinates. negate_ord() allows the user to negate specified coordinates of an ordination.

get_negation() accesses the negations of an ordination, an integer vector of 1s and -1s stored as a "negate" attribute.

Value

negate_ord() and negate_to_first_orthant() return a tbl_ord with certain axes negated but the wrapped model unchanged. get_negation() returns the current negations. revert_negation() returns the tbl_ord without any manual negations.

A tbl_ord; the wrapped model is unchanged.

Examples

(pca <- ordinate(iris, cols = 1:4, prcomp))
ggbiplot(pca) + geom_rows_point() + geom_cols_vector()

# manually negate second coordinate
(pca_neg <- negate_ord(pca, 2))
ggbiplot(pca_neg) + geom_rows_point() + geom_cols_vector()

# NB: 'prcomp' method takes precedence; negations are part of the wrapper
biplot(pca)
biplot(pca_neg)

# negate to the first orthant
(pca_orth <- negate_to_first_orthant(pca, "v"))
get_negation(pca_orth)

ordr documentation built on Oct. 21, 2022, 1:07 a.m.