pca123: PCA step 1, 2, 3.

View source: R/pca.R

pca123R Documentation

PCA step 1, 2, 3.

Description

PCA step 1, 2, 3.

Usage

pca123(x, k = 50)

Arguments

x

A matrix which has columns as features and rows as samples.

k

Number of eigenvalues requested.

Details

PCA steps 1, 2, 3 are:

  1. Center and scale.

  2. Compute the correlation/covariance matrix.

  3. Calculate the eigenvectors and eigenvalues.

I use eigs function in Rspectra package instead of eigen function in base to deal with large matrix.

Value

A list of four elements:

  • scaled A matrix of scaled input matrix.

  • cor_mat Correlation/covariance matrix of the scaled matrix.

  • eigs A list returned by eigs.

  • plot A ggplot object of density plot of eigenvalues.


markgene/yamatClassifier documentation built on Oct. 14, 2024, 2:36 a.m.