pca123 | R Documentation |
PCA step 1, 2, 3.
pca123(x, k = 50)
x |
A matrix which has columns as features and rows as samples. |
k |
Number of eigenvalues requested. |
PCA steps 1, 2, 3 are:
Center and scale.
Compute the correlation/covariance matrix.
Calculate the eigenvectors and eigenvalues.
I use eigs
function in Rspectra package
instead of eigen
function in base to deal
with large matrix.
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.