irlba
package.
prcomp_irlba(x, n = 3, retx = TRUE, center = TRUE, scale. = FALSE, ...)
min(dim(x))
.x
can be supplied.FALSE
for consistency with S, but scaling is often advisable.
Alternatively, a vector of length equal the number of columns of x
can be supplied.irlba
.retx
is TRUE
the value of the rotated data (the centred
(and scaled if requested) data multiplied by the rotation
matrix) is returned. Hence, cov(x)
is the diagonal matrix
diag(sdev^2)
.
FALSE
.
prcomp
set.seed(1)
x <- matrix(rnorm(200), nrow=20)
p1 <- prcomp_irlba(x, n=3)
summary(p1)
# Compare with
p2 <- prcomp(x, tol=0.7)
summary(p2)
Run the code above in your browser using DataLab