This summarizes information about the components of a gt_dapc from the tidypopgen package. The parameter matrix determines which element is returned.

# S3 method for class 'gt_dapc'
tidy(x, matrix = "eigenvalues", ...)

Arguments

x

A gt_dapc object (as returned by gt_dapc()).

matrix

Character specifying which component of the DAPC should be tidied.

  • "samples", "scores", or "x": returns information about the map from the original space into the least discriminant axes.

  • "v", "rotation", "loadings" or "variables": returns information about the map from discriminant axes space back into the original space (i.e. the genotype frequencies). Note that this are different from the loadings linking to the PCA scores (which are available in the element $loadings of the dapc object).

  • "d", "eigenvalues" or "lds": returns information about the eigenvalues.

...

Not used. Needed to match generic signature only.

Value

A tibble::tibble with columns depending on the component of DAPC being tidied.

If "scores" each row in the tidied output corresponds to the original data in PCA space. The columns are:

row

ID of the original observation (i.e. rowname from original data).

LD

Integer indicating a principal component.

value

The score of the observation for that particular principal component. That is, the location of the observation in PCA space.

If matrix is "loadings", each row in the tidied output corresponds to information about the principle components in the original space. The columns are:

row

The variable labels (colnames) of the data set on which PCA was performed.

LD

An integer vector indicating the principal component.

value

The value of the eigenvector (axis score) on the indicated principal component.

If "eigenvalues", the columns are:

LD

An integer vector indicating the discriminant axis.

std.dev

Standard deviation (i.e. sqrt(eig/(n-1))) explained by this DA (for compatibility with prcomp.

cumulative

Cumulative variation explained by principal components up to this component (note that this is NOT phrased as a percentage of total variance, since many methods only estimate a truncated SVD.