R/r2qPCA.R

Defines functions .r2qPCA

.r2qPCA <- function(x) {

  # Modifies objects of class princomp (R-mode PCA) to more closely resemble class prcomp (Q-mode PCA)

  if (!inherits(x, "princomp")) stop("The PCA object was not of class princomp")

  # sdev, center and scale for both classes are the same; no change necessary
  # Other list elements carried along unchanged
  # Can fully pass as class prcomp

  x$rotation <- x$loadings
  x$loadings <- NULL
  x$x <- x$scores
  x$scores <- NULL
  class(x) <- c("converted_from_princomp", "prcomp")
  x
}

Try the ChemoSpec package in your browser

Any scripts or data that you put into this service are public.

ChemoSpec documentation built on June 7, 2023, 6:13 p.m.