recoverers: Access factors, coordinates, and metadata from ordination...

recoverersR Documentation

Access factors, coordinates, and metadata from ordination objects

Description

These functions return information about the matrix factorization underlying an ordination.

Usage

recover_rows(x)

recover_cols(x)

## Default S3 method:
recover_rows(x)

## Default S3 method:
recover_cols(x)

## S3 method for class 'data.frame'
recover_rows(x)

## S3 method for class 'data.frame'
recover_cols(x)

get_rows(x, elements = "all")

get_cols(x, elements = "all")

## S3 method for class 'tbl_ord'
as.matrix(x, ..., .matrix, elements = "all")

recover_inertia(x)

## Default S3 method:
recover_inertia(x)

recover_coord(x)

## Default S3 method:
recover_coord(x)

## S3 method for class 'data.frame'
recover_coord(x)

get_coord(x)

get_inertia(x)

## S3 method for class 'tbl_ord'
dim(x)

Arguments

x

An object of class 'tbl_ord'.

elements

Character vector; which elements of each factor for which to render graphical elements. One of "all" (the default), "active", or any supplementary element type defined by the specific class methods (e.g. "score" for 'factanal', 'lda_ord', and 'cancord_ord' and "intraset" and "interset" for 'cancor_ord').

...

Additional arguments from base::as.matrix(); ignored.

.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

The recover_*() S3 methods extract one or both of the row and column matrix factors that constitute the original ordination. These are interpreted as the case scores (rows) and the variable loadings (columns). The get_*() functions optionally (and by default) include any supplemental observations (see supplementation).

The recover_*() functions are generics that require methods for each ordination class. They are not intended to be called directly but are exported so that users can query methods("recover_*").

get_coord() retrieves the names of the coordinates shared by the matrix factors on which the original data were ordinated, and get_inertia() retrieves a vector of the inertia with these names. dim() retrieves the dimensions of the row and column factors, which reflect the dimensions of the matrix they reconstruct—not the original data matrix. (This matters for techniques that rely on eigendecomposition, for which the decomposed matrix is square.)

Value

The recover_*() functions are generics whose methods return base R objects retrieved from the model wrapped in the 'tbl_ord' class:

  • rows: the row matrix as stored in the model

  • cols: the column matrix as stored in the model

  • inertia: the vector of eigen-values or squared singular values, often known by other names depending on the model

  • coord: names for the artificial axes, from the model if available The get_*() functions (which are not generics) return modifications of these objects:

  • rows: the recovered rows, adjusted according to any negation of axes or conference of inertia

  • cols: the recovered columns, adjusted according to any negation of axes or conference of inertia

  • inertia: the recovered inertia, named by the recovered coordinates

  • coord: the recovered coordinates (unmodified) dim() returns the dimensions of the decomposed matrix, i.e. the numbers of rows of recover_rows() and of recover_cols().

See Also

Other generic recoverers: augmentation, conference, supplementation

Examples

# example ordination: LRA of U.S. arrests data
arrests_lra <- ordinate(USArrests, cols = c(Murder, Rape, Assault), lra)

# extract matrix factors
as.matrix(arrests_lra, .matrix = "rows")
as.matrix(arrests_lra, .matrix = "cols")
# special named functions
get_rows(arrests_lra)
get_cols(arrests_lra)
# get dimensions of underlying matrix factorization (not of original data)
dim(arrests_lra)

# get names of artificial / latent coordinates
get_coord(arrests_lra)
# get distribution of inertia
get_inertia(arrests_lra)

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