Learn R Programming

candisc (version 1.0.0)

reflect: Reflect Columns in an Object, reversing the sign of all elements

Description

candisc and cancor objects have coefficients for the X and Y and weighted scores for these, whose signs are arbitrary, in the sense that a given column can be reflected (multiplied by -1) without changing the fit. But, often you will want to reverse the direction of one or more dimensions for ease of interpretation.

This function allows you to reflect any columns of the variable coefficients (and corresponding observation scores). This is often useful for interpreting a biplot, for example when a component (often the first) has all negative signs.

Usage

reflect(object, columns = 1:2, ...)

# S3 method for data.frame reflect(object, columns = 1:2, ...)

# S3 method for cancor reflect(object, columns = 1:2, ...)

# S3 method for candisc reflect(object, columns = 1:2, ...)

Value

The object with specified columns of the variable coefficients and observation scores multiplied by -1.

Arguments

object

An object whose columns are to be reflected

columns

a vector of indices of the columns to reflect

...

Unused

Methods (by class)

  • reflect(data.frame): "data.frame" method.

  • reflect(cancor): "cancor" method.

  • reflect(candisc): "candisc" method.

Author

Michael Friendly

Details

reflect methods are available for:

  • data.frames

  • "cancor" objects

  • "candisc" objects

Note that plot.candisc() and plot.candisc() can handle this internally using the argument rev.axes.

See Also

ggbiplot::reflect has similar methods for PCA-like objects