Skip to contents

Convenience wrapper around svd with center = TRUE.

Usage

pca(A, k = 10, ...)

Arguments

A

Input matrix. May be dense (matrix), sparse (dgCMatrix), or a path to a .spz file for out-of-core streaming SVD.

k

Number of factors (rank). Use "auto" for automatic rank selection via cross-validation. Default: 10.

...

Additional arguments passed to svd.

Value

An S4 object of class svd (see svd).

See also

Examples

# \donttest{
library(Matrix)
data(aml)
result <- pca(aml, k = 5)
result
#> 824x5 rank-5 PCA model of class "svd"
#>   sigma range: [10.55, 29.15]
#>   wall time: 1.2 ms
# }