Learn R Programming

ChemoSpec (version 3.0-1)

q2rPCA: Conversion Between PCA Classes

Description

Utility to convert objects of S3 class "prcomp" (Q-mode PCA) to objects of S3 class "princomp" (R-mode PCA) or vice-versa. Not likely to be called by most users.

Usage

q2rPCA(x)
r2qPCA(x)

Arguments

x
An object of either class "prcomp" or class "princomp". It will be converted to a form that can be used by functions expecting either class.

Value

  • A list of class "conPCA". Note that the order of the elements will vary depending upon the direction of conversion.
  • loadingsThe loadings from "princomp", or a copy of the rotations from "prcomp".
  • scoresThe scores from "princomp", or a copy of the x values from "prcomp".
  • callThe call. Objects of class "prcomp" do not store the original call, so a place holder is used. Otherwise the unchanged call from "princomp".
  • n.obsThe number of observations from "princomp", or computed from the 1st dimension of x in "prcomp".
  • class"conPCA" is pre-pended to the existing class.
  • sdevUnchanged from original.
  • centerUnchanged from original.
  • scaleUnchanged from original.

Details

In the conversion, the necessary list elements are added; the "old" elements are not deleted (and user added list elements are not affected). To indicate this, the class attribute is updated to include class "conPCA". The new object can then be used by functions expecting either class prcomp or princomp. For details of the structure of prcomp or princomp, see their respective help pages.

References

https://github.com/bryanhanson/ChemoSpec

See Also

prcomp, princomp