Perform principal components analysis.

stats_pca(rm_mean = TRUE, rm_sd = FALSE, x, sdev, rot = NULL)

Arguments

rm_mean, rm_sd

Should the data be centered/scaled first? Operations occur in-place.

x

Input matrix. The input values are overwritten.

sdev

The standard deviations for the principal components.

rot

The pca loadings. If NULL is passed, then these will not be calculated.

Examples

suppressMessages(library(fmlr)) x = cpumat(3, 2) x$fill_linspace(1, 6) s = cpuvec() stats_pca(TRUE, TRUE, x, s) s$info()
#> # cpuvec 2 type=d
s$print()
#> 1.4142 0.0000 #>