| pca | R Documentation |
Performs PCA using KODAMA's internal vendored IRLBA backend (with a small-matrix
svd() fallback) and returns a prcomp-compatible object.
pca(x, nv = min(50L, ncol(x)), ...)
x |
A numeric matrix of data. |
nv |
Number of principal components to compute. |
... |
Currently unused, kept for backward compatibility. |
The function returns a list with class prcomp containing:
sdev |
standard deviations of the retained principal components. |
rotation |
matrix of variable loadings (columns are retained components). |
x |
scores matrix equivalent to |
center, scale |
set to |
txt |
percentage-of-variance labels for each retained component. |
Stefano Cacciatore
Baglama J, Reichel L.
Augmented implicitly restarted Lanczos bidiagonalization methods.
SIAM Journal on Scientific Computing 2005;27(1):19-42.
data(MetRef)
u <- MetRef$data
u <- u[, -which(colSums(u) == 0)]
u <- normalization(u)$newXtrain
u <- scaling(u)$newXtrain
class <- as.numeric(as.factor(MetRef$gender))
cc <- pca(u, nv = 5)
plot(cc$x, pch = 21, bg = class)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.